:root {
  color-scheme: dark;
  --bg: #15120f;
  --panel: #231d18;
  --panel-2: #302720;
  --text: #fff4e6;
  --muted: #d2bda7;
  --brand: #ffcd4d;
  --brand-2: #ff7a59;
  --danger: #ff4d6d;
  --ok: #76e4a6;
  --border: rgba(255, 244, 230, 0.16);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 205, 77, 0.22), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(255, 122, 89, 0.18), transparent 26rem),
    linear-gradient(180deg, #15120f 0%, #0e0c0a 100%);
  min-height: 100vh;
  padding-bottom: calc(76px + var(--safe-bottom));
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(255, 205, 77, .76);
  outline-offset: 3px;
}

.is-hidden { display: none !important; }

.site-header {
  width: min(1180px, calc(100% - 24px));
  margin: 12px auto 0;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(35, 29, 24, 0.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 10px;
  z-index: 20;
}

.brand {
  font-weight: 900;
  letter-spacing: -0.04em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--brand);
  color: #1c1408;
}

.desktop-nav { display: flex; gap: 6px; }
.desktop-nav a {
  color: var(--muted);
  font-weight: 800;
  padding: 12px 13px;
  border-radius: 999px;
}
.desktop-nav a:hover { color: var(--text); background: rgba(255,255,255,.08); }

main { width: min(1180px, calc(100% - 24px)); margin: 0 auto; }

.hero {
  padding: 54px 0 42px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 38px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
}

h1, h2, h3 {
  margin: 0;
  line-height: .96;
  letter-spacing: -0.06em;
  overflow-wrap: anywhere;
}

h1 {
  font-family: "Archivo Black", Inter, sans-serif;
  font-size: clamp(3rem, 10.2vw, 7.8rem);
  max-width: 820px;
}

h2 { font-size: clamp(2rem, 7vw, 4.3rem); }
h3 { font-size: clamp(2.05rem, 8vw, 4.8rem); }

.lead {
  color: var(--muted);
  font-size: clamp(1.03rem, 3.7vw, 1.35rem);
  line-height: 1.55;
  max-width: 620px;
  margin: 22px 0 0;
}

.humor-warning {
  margin-top: 18px;
  max-width: 660px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255, 205, 77, .34);
  background: rgba(255, 205, 77, .1);
  border-radius: 22px;
  padding: 14px 15px;
  color: var(--muted);
}
.humor-warning span { font-size: 1.25rem; line-height: 1; }
.humor-warning p { margin: 0; line-height: 1.45; }
.humor-warning strong { color: var(--text); }

.sync-status {
  margin: 16px 0 0;
  color: var(--ok);
  font-weight: 900;
  font-size: .95rem;
}
.sync-status.warning { color: var(--brand); }

.hero-actions, .verdict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 15px 20px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.1;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-primary { background: var(--brand); color: #1c1408; }
.btn-secondary { background: rgba(255,255,255,.1); color: var(--text); border: 1px solid var(--border); }

.court-card,
.trial-card,
.verdict-card,
.submit-form,
.ranking-list {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(48, 39, 32, .95), rgba(35, 29, 24, .9));
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.court-card {
  min-height: 430px;
  padding: 34px;
  position: relative;
  overflow: hidden;
  transform: rotate(2deg);
}
.court-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px dashed rgba(255, 244, 230, .18);
  border-radius: 26px;
}
.court-card > * { position: relative; z-index: 1; }
.court-card h2 { font-size: clamp(2rem, 5vw, 3.7rem); margin-top: 44px; }
.court-card p { color: var(--muted); line-height: 1.5; font-size: 1.06rem; }
.court-card .sentence { color: var(--text); font-weight: 900; }

.stamp {
  position: absolute;
  right: -18px;
  top: 32px;
  transform: rotate(14deg);
  border: 5px solid var(--danger);
  color: var(--danger);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 4rem);
  padding: 8px 18px;
  border-radius: 12px;
  opacity: .9;
}

.case-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 900;
}

.section { padding: 46px 0; scroll-margin-top: 104px; }
.section-title { margin-bottom: 18px; }
.section-title h2 { max-width: 900px; }

.trial-card { padding: clamp(22px, 5vw, 42px); }
.trial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--brand);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}
.icon-button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1.18rem;
}
.crime {
  color: var(--muted);
  font-size: clamp(1.06rem, 3.8vw, 1.25rem);
  line-height: 1.5;
  margin: 20px 0;
}

.trial-photo {
  margin: 18px 0 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}
.trial-photo img {
  display: block;
  width: 100%;
  max-height: min(58vh, 520px);
  object-fit: cover;
}

.meter {
  height: 14px;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  overflow: hidden;
  margin: 22px 0 10px;
}
.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ok), var(--brand), var(--danger));
  border-radius: inherit;
  transition: width .25s ease;
}
.vote-summary { color: var(--muted); margin: 0 0 20px; font-weight: 700; }

.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.vote-btn {
  min-height: 104px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  font-size: clamp(1.05rem, 4vw, 1.22rem);
  line-height: 1.15;
  touch-action: manipulation;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 14px;
}
.vote-btn small {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}
.vote-emoji {
  display: block;
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 1;
}
.vote-btn:hover { background: rgba(255,255,255,.14); }
.vote-btn:disabled, .icon-button:disabled { opacity: .55; cursor: wait; }
.vote-btn:active { transform: scale(.985); }
.vote-btn.thumb-up { border-color: rgba(118, 228, 166, .42); }
.vote-btn.thumb-down { border-color: rgba(255, 77, 109, .42); }
.vote-btn.thumb-up:hover { background: rgba(118, 228, 166, .12); }
.vote-btn.thumb-down:hover { background: rgba(255, 77, 109, .12); }

.verdict-card {
  padding: clamp(24px, 5vw, 44px);
  background:
    linear-gradient(145deg, rgba(255,205,77,.16), rgba(255,122,89,.1)),
    var(--panel);
}
.verdict-card h2 { max-width: 920px; }
.verdict-card p:not(.case-label) {
  color: var(--muted);
  font-size: clamp(1.05rem, 3.8vw, 1.18rem);
  line-height: 1.55;
  max-width: 820px;
}

.ranking-list { padding: 8px; }
.rank-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 58px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.rank-item:hover { background: rgba(255,255,255,.06); }
.rank-item + .rank-item { border-top: 1px solid var(--border); }
.rank-copy { display: block; }
.rank-photo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
}
.rank-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.3rem;
}
.rank-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-weight: 900;
}
.rank-item strong { display: block; font-size: 1.04rem; }
.rank-item span { color: var(--muted); font-size: .95rem; }
.rank-item .rank-number { color: var(--text); }
.rank-score { color: var(--brand); font-weight: 900; white-space: nowrap; }

.submit-section {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 24px;
  align-items: start;
}
.submit-copy p:not(.eyebrow) { color: var(--muted); line-height: 1.6; font-size: 1.05rem; }
.submit-form { padding: clamp(20px, 5vw, 26px); display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-weight: 900; color: var(--text); }
.optional-label, .file-hint {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 18px;
  padding: 15px;
  min-height: 52px;
  outline: none;
}
textarea { min-height: 124px; resize: vertical; }
input[type="file"] {
  padding: 13px;
  color: var(--muted);
  cursor: pointer;
}
input::file-selector-button {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #1c1408;
  font-weight: 900;
  padding: 10px 12px;
  margin-right: 12px;
  cursor: pointer;
}
input:focus, textarea:focus { border-color: rgba(255,205,77,.72); }
.photo-preview {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}
.photo-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}
.photo-preview figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
  font-size: .88rem;
}
.form-message { margin: 0; color: var(--brand); font-weight: 800; }

.mobile-nav {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 30;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(22, 18, 15, .88);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 50px rgba(0,0,0,.38);
}
.mobile-nav a {
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  border-radius: 18px;
}
.mobile-nav span { font-size: 1.25rem; line-height: 1; }
.mobile-nav a:active, .mobile-nav a:hover { background: rgba(255,255,255,.08); color: var(--text); }

.site-footer {
  width: min(1180px, calc(100% - 24px));
  margin: 40px auto 20px;
  padding: 24px 0;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--border);
}
.small { font-size: .9rem; opacity: .8; }

@media (max-width: 880px) {
  .hero, .submit-section { grid-template-columns: 1fr; }
  .court-card { transform: none; min-height: 360px; }
  .vote-grid { grid-template-columns: 1fr; }
  .rank-item { grid-template-columns: auto 54px 1fr; align-items: start; }
  .rank-photo { width: 54px; height: 54px; border-radius: 16px; }
  .rank-score { grid-column: 3; white-space: normal; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(96px + var(--safe-bottom)); }
  .site-header { width: min(100% - 20px, 1180px); }
  .desktop-nav { display: none; }
  .mobile-nav { display: grid; }
  main { width: min(100% - 20px, 1180px); }
  .hero { padding: 42px 0 28px; }
  .hero-actions, .verdict-actions { display: grid; grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .court-card, .trial-card, .verdict-card, .submit-form, .ranking-list { border-radius: 26px; }
  .court-card { padding: 24px; min-height: 330px; }
  .court-card::before { inset: 12px; border-radius: 20px; }
  .stamp { right: -16px; top: 22px; border-width: 4px; }
  .section { padding: 38px 0; scroll-margin-top: 92px; }
  .vote-btn { min-height: 96px; }
  .rank-item { padding: 15px; gap: 12px; }
  .site-footer { width: min(100% - 20px, 1180px); margin-bottom: 104px; }
}

@media (max-width: 380px) {
  .brand { font-size: .95rem; }
  .brand-mark { width: 38px; height: 38px; }
  h1 { font-size: clamp(2.55rem, 12vw, 3.3rem); }
  .mobile-nav { left: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

.comment-panel {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

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

.comment-heading h4 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2.2rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.comment-lock {
  border: 1px solid rgba(255, 205, 77, .28);
  background: rgba(255, 205, 77, .08);
  color: var(--brand);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: .82rem;
  font-weight: 900;
  text-align: right;
}

.auth-card,
.comment-form,
.comments-list {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.055);
  border-radius: 24px;
}

.auth-card {
  padding: 16px;
  margin-bottom: 14px;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.comment-form {
  padding: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.comment-form textarea {
  min-height: 96px;
}

.comment-form textarea:disabled,
.comment-form button:disabled {
  opacity: .62;
  cursor: not-allowed;
}

.comments-list {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.comment-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.055);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: .9rem;
}

.comment-meta strong {
  color: var(--brand);
  font-weight: 900;
}

.comment-meta time {
  white-space: nowrap;
  opacity: .82;
}

.comment-item p,
.empty-comments {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.empty-comments {
  padding: 14px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 640px) {
  .comment-heading {
    display: grid;
  }

  .comment-lock {
    text-align: left;
    width: fit-content;
  }

  .auth-form,
  .auth-actions {
    grid-template-columns: 1fr;
  }

  .comment-meta {
    display: grid;
    gap: 4px;
  }
}
