:root {
  --bg: #0a0a0c;
  --card: rgba(18, 16, 22, 0.88);
  --border: rgba(201, 162, 39, 0.28);
  --text: #f2ece4;
  --muted: #a89f94;
  --accent: #c9a227;
  --accent-2: #8f1d1d;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(8, 6, 10, 0.75) 0%, rgba(8, 6, 10, 0.92) 55%, rgba(5, 4, 8, 0.96) 100%),
    url('/bg.png') center center / cover no-repeat fixed;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.06;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.5) 2px,
    rgba(0, 0, 0, 0.5) 4px
  );
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 12px;
  font-family: 'Special Elite', serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(143, 29, 29, 0.25);
  border: 1px solid rgba(143, 29, 29, 0.45);
  border-radius: 4px;
  color: #e8b4b4;
}

h1 {
  font-family: 'Special Elite', serif;
  font-size: clamp(1.65rem, 6vw, 2.15rem);
  line-height: 1.2;
  margin: 0 0 16px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.8);
}

.highlight {
  color: var(--accent);
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.lead.sub {
  margin-top: 12px;
  font-size: 0.95rem;
}

.lead strong {
  color: var(--text);
}

.timer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px 24px;
  text-align: center;
  margin-bottom: 32px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.timer-label {
  margin: 0;
  font-family: 'Special Elite', serif;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.deadline {
  margin: 8px 0 20px;
  font-weight: 600;
  color: var(--accent);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.unit {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(201, 162, 39, 0.15);
  border-radius: 10px;
  padding: 12px 4px;
}

.unit span {
  display: block;
  font-family: 'Special Elite', serif;
  font-size: clamp(1.45rem, 5vw, 1.9rem);
  line-height: 1.1;
  color: var(--accent);
}

.unit small {
  display: block;
  margin-top: 4px;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
}

.timer-done {
  margin: 16px 0 0;
  color: #e8b4b4;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.comments-section h2 {
  font-family: 'Special Elite', serif;
  font-size: 1.3rem;
  margin: 0 0 6px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.sort-btn {
  flex-shrink: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(12, 10, 14, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.sort-btn:active {
  border-color: rgba(201, 162, 39, 0.55);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.field span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: rgba(12, 10, 14, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(201, 162, 39, 0.55);
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.audio-recorder {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.audio-rec-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.audio-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rec-btn {
  padding: 12px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(143, 29, 29, 0.35);
  border: 1px solid rgba(143, 29, 29, 0.5);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rec-btn-stop {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.45);
}

.recording-pulse {
  animation: pulse-rec 1s ease-in-out infinite;
}

@keyframes pulse-rec {
  50% {
    opacity: 0.65;
  }
}

.record-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--accent);
  min-height: 1.2em;
}

.record-preview,
.comment-audio {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.comment-audio {
  margin-top: 12px;
}

.photo-field {
  position: relative;
}

.photo-field input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.photo-btn {
  display: block;
  text-align: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.photo-name {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.preview {
  text-align: center;
}

.preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  object-fit: contain;
  background: #000;
  border: 1px solid var(--border);
}

.link-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px;
}

.submit {
  width: 100%;
  padding: 16px;
  font-family: 'Special Elite', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #1a1208;
  background: linear-gradient(135deg, #d4af37, #a67c00);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.form-error {
  margin: 0;
  color: #e8b4b4;
  font-size: 0.9rem;
  text-align: center;
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-list .loading,
.comment-list .empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.comment-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(8px);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-meta-main {
  flex: 1;
  min-width: 0;
}

.comment-actions {
  flex-shrink: 0;
}

.share-btn {
  padding: 6px 10px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.share-btn.share-ok {
  border-color: rgba(201, 162, 39, 0.55);
  color: var(--accent);
}

.comment-item.post-focused {
  border-color: rgba(201, 162, 39, 0.75);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25);
}

.comment-video {
  display: block;
  width: 100%;
  margin-top: 12px;
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--border);
  max-height: 70vh;
}

.comment-meta-main strong {
  display: block;
  font-size: 0.95rem;
  color: var(--accent);
}

.comment-meta-main time {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.comment-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-photo-link {
  display: block;
  margin-top: 12px;
  padding: 0;
  border: none;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

.comment-photo {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  vertical-align: middle;
}

.comment-photo-hint {
  display: block;
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.94);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
