:root {
  --green: #4a7c59;
  --green-dark: #3d6b4a;
  --bg: #fafaf8;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-light: #777;
  --border: #e8e8e4;
  --error: #c0392b;
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Password Screen */

#password-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.password-box {
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.password-box h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--green);
}

.password-box p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#password-input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

#password-input:focus {
  border-color: var(--green);
}

.error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Header */

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--green);
}

.subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Toolbar */

.toolbar {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

/* Buttons */

.btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--green-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Tabs */

.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.6rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 500;
}

/* Form */

#upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#upload-form input[type="text"],
#upload-form input[type="url"] {
  padding: 0.7rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

#upload-form input:focus {
  border-color: var(--green);
}

#file-input {
  display: none;
}

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-light);
  transition: border-color 0.2s, color 0.2s;
  text-align: center;
}

.file-label:hover {
  border-color: var(--green);
  color: var(--green);
}

.file-label.has-file {
  border-style: solid;
  border-color: var(--green);
  color: var(--green);
  padding: 0.75rem;
}

#image-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

/* Feed */

#feed {
  max-width: 560px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Post Card */

.post-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-media img {
  width: 100%;
  display: block;
}

.post-media .video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.post-media .video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.post-info {
  padding: 0.75rem 1rem;
}

.post-caption {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Comments */

.comments-section {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.comments-toggle {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.5rem;
}

.comments-toggle:hover {
  color: var(--green);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.comment {
  font-size: 0.85rem;
}

.comment-author {
  font-weight: 600;
  margin-right: 0.35rem;
}

.comment-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.comment-form input {
  flex: 1;
  min-width: 80px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  outline: none;
}

.comment-form input:focus {
  border-color: var(--green);
}

.comment-form button {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
}

.comment-form button:hover {
  background: var(--green-dark);
}

/* Empty & Loading */

#empty-state,
#loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

/* Utility */

[hidden] {
  display: none !important;
}
