:root {
  color-scheme: dark;
  --bg: #11131a;
  --surface: #191c24;
  --surface-2: #222631;
  --text: #f5f0e6;
  --muted: #a8a6a1;
  --accent: #ff7a45;
  --accent-2: #ffc857;
  --danger: #ff5f68;
  --line: rgba(255,255,255,.1);
  --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 0%, rgba(255,122,69,.12), transparent 28rem),
    radial-gradient(circle at 0% 45%, rgba(255,200,87,.06), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .035; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }

.site-header { max-width: 1240px; margin: auto; padding: 28px 28px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: .82rem; line-height: 1.05; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,122,69,.45); border-radius: 50%; color: var(--accent); font-family: Georgia, serif; font-size: 2rem; padding-top: 7px; }
.auth-area { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .9rem; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #281209; font-weight: 800; }

.hero { max-width: 1240px; margin: auto; padding: 90px 28px 120px; position: relative; }
.hero::after { content: "”"; position: absolute; right: 4%; top: 0; color: rgba(255,255,255,.025); font: 32rem/.8 Georgia,serif; z-index: -1; }
.eyebrow { color: var(--accent); letter-spacing: .2em; font-size: .72rem; font-weight: 800; margin: 0 0 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 900px; margin-bottom: 28px; font: 700 clamp(3.7rem, 9vw, 8.4rem)/.87 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
h1 em { color: var(--accent); font-weight: 400; }
.hero-copy { max-width: 620px; color: var(--muted); font-size: 1.12rem; line-height: 1.75; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 36px; }

.button { border: 0; border-radius: 100px; padding: 12px 19px; cursor: pointer; font-weight: 750; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: #27140c; }
.button.primary:hover { background: #ff8d60; }
.button.ghost { background: transparent; border: 1px solid var(--line); }
.button.ghost:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.04); }
.button.danger { background: var(--danger); color: #270508; }
.button.small { padding: 7px 11px; font-size: .78rem; }
.button.wide { width: 100%; margin-top: 8px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(17,19,26,.45); cursor: pointer; }

.content { max-width: 1240px; margin: auto; padding: 0 28px 100px; }
.content-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 32px; }
h2 { font: 700 clamp(2.2rem, 5vw, 4rem)/1 Georgia,serif; letter-spacing: -.035em; margin-bottom: 0; }
.search { min-width: min(320px,100%); display: flex; align-items: center; gap: 10px; padding: 11px 15px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 100px; color: var(--muted); }
.search input { width: 100%; border: 0; outline: 0; background: none; color: var(--text); }
.search input::placeholder { color: #7f7e7a; }

.quote-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.quote-card { grid-column: span 6; min-height: 410px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #232733, #181b23); box-shadow: 0 10px 40px rgba(0,0,0,.14); scroll-margin-top: 24px; }
.quote-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,69,.2), 0 18px 55px rgba(0,0,0,.35); }
.quote-card:nth-child(3n) { grid-column: span 7; }
.quote-card:nth-child(3n + 1):not(:first-child) { grid-column: span 5; }
.quote-bg { position: absolute; inset: 0; overflow: hidden; filter: saturate(.8); transform: scale(1.015); }
.quote-bg-image { width: 100%; height: 100%; object-fit: cover; }
.quote-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,12,16,.28), rgba(11,12,16,.9)); }
.quote-card.no-image::before { content: "“"; position: absolute; right: 18px; top: -35px; color: rgba(255,255,255,.045); font: 14rem Georgia,serif; }
.quote-inner { min-height: 410px; position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(24px,4vw,42px); }
.quote-top-actions { position: absolute; top: 18px; right: 18px; display: flex; gap: 7px; }
.quote-text { font: 650 clamp(1.7rem,3.2vw,2.7rem)/1.12 Georgia,serif; letter-spacing: -.025em; margin: 0 0 22px; white-space: pre-wrap; }
.quote-person { font-weight: 800; }
.quote-context { margin: 5px 0 0; color: rgba(255,255,255,.67); font-size: .88rem; }
.quote-meta { display: flex; justify-content: space-between; gap: 10px; align-items: end; }
.quote-by { color: rgba(255,255,255,.52); font-size: .75rem; text-align: right; }

.comments { position: relative; z-index: 1; background: #151820; border-top: 1px solid var(--line); padding: 22px clamp(22px,4vw,38px) 26px; }
.comments-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
.comment-list { display: grid; gap: 10px; }
.comment { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.comment:last-child { border-bottom: 0; }
.comment-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--accent-2); font-size: .72rem; font-weight: 800; }
.comment-body p { margin: 0 0 4px; line-height: 1.45; white-space: pre-wrap; }
.comment-body small { color: var(--muted); }
.comment-actions { display: flex; gap: 5px; }
.text-button { border: 0; padding: 2px; color: var(--muted); background: none; cursor: pointer; font-size: .74rem; }
.text-button:hover { color: var(--text); }
.comment-form { display: flex; gap: 8px; margin-top: 13px; }
.comment-form input { flex: 1; min-width: 0; }
.login-hint { margin: 13px 0 0; color: var(--muted); font-size: .85rem; }
.login-hint button { border: 0; padding: 0; color: var(--accent); background: none; cursor: pointer; }

.notice { margin-bottom: 20px; padding: 13px 16px; border: 1px solid rgba(255,122,69,.3); border-radius: 12px; background: rgba(255,122,69,.08); }
.empty { text-align: center; padding: 90px 20px; color: var(--muted); }
.empty span { color: var(--accent); font: 7rem/.5 Georgia,serif; }
.empty h3 { color: var(--text); font: 2rem Georgia,serif; margin: 24px 0 10px; }
footer { border-top: 1px solid var(--line); padding: 35px 28px; text-align: center; color: #777873; font-size: .82rem; }

input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.045); color: var(--text); padding: 12px 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,69,.12); }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: #d9d6ce; font-size: .84rem; font-weight: 700; }
label span { color: var(--muted); font-weight: 400; }

.dialog { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 32px); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 24px; background: #1a1d26; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(4,5,8,.78); backdrop-filter: blur(7px); }
.dialog-card { position: relative; display: grid; gap: 17px; padding: clamp(25px,5vw,45px); }
.dialog-close { position: absolute; right: 18px; top: 18px; font-size: 1.25rem; }
.dialog h2 { font-size: 2.7rem; margin-bottom: 0; }
.small-dialog { width: min(440px, calc(100% - 28px)); }
.wide-dialog { width: min(920px, calc(100% - 28px)); }
.muted { color: var(--muted); line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 9px; background: rgba(255,95,104,.12); color: #ff9ba1; font-size: .85rem; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.image-preview { width: 100%; height: 160px; object-fit: cover; border-radius: 15px; border: 1px solid var(--line); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

.new-user-form { display: grid; grid-template-columns: 1fr 1.3fr .8fr auto; gap: 10px; align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.new-user-form .form-error { grid-column: 1/-1; }
.user-list { display: grid; gap: 9px; }
.user-row { display: grid; grid-template-columns: minmax(100px,1fr) 120px 180px auto; gap: 10px; align-items: center; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.user-row strong { overflow: hidden; text-overflow: ellipsis; }
.user-stats { color: var(--muted); font-size: .76rem; }
.user-actions { display: flex; gap: 6px; justify-content: end; }

@media (max-width: 800px) {
  .hero { padding-top: 65px; padding-bottom: 90px; }
  .content-head { align-items: stretch; flex-direction: column; }
  .quote-card, .quote-card:nth-child(3n), .quote-card:nth-child(3n + 1):not(:first-child) { grid-column: 1/-1; }
  .new-user-form { grid-template-columns: 1fr 1fr; }
  .new-user-form .button { align-self: end; }
  .user-row { grid-template-columns: 1fr auto; }
  .user-stats { grid-column: 1; }
  .user-row select { grid-column: 2; grid-row: 1; }
  .user-actions { grid-column: 2; grid-row: 2; }
}

@media (max-width: 520px) {
  .site-header { padding: 20px 18px; }
  .hero, .content { padding-left: 18px; padding-right: 18px; }
  .hero { padding-top: 48px; }
  h1 { font-size: 3.45rem; }
  .user-chip > span:not(.avatar) { display: none; }
  .form-row, .new-user-form { grid-template-columns: 1fr; }
  .quote-inner { min-height: 370px; }
  .quote-meta { display: block; }
  .quote-by { margin-top: 14px; text-align: left; }
  .comment { grid-template-columns: 28px 1fr; }
  .comment-actions { grid-column: 2; }
  .comment-form { align-items: stretch; flex-direction: column; }
}
