:root {
  --ink: #17211d;
  --paper: #f4f1e8;
  --card: rgba(255, 255, 255, .72);
  --line: rgba(23, 33, 29, .13);
  --accent: #ff5a36;
  --green: #1a7554;
  --lime: #c9ef75;
  --muted: #6f7772;
  --shadow: 0 18px 50px rgba(44, 52, 45, .10);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 100% 0%, rgba(201, 239, 117, .55), transparent 34rem),
    radial-gradient(circle at 0% 45%, rgba(255, 90, 54, .10), transparent 25rem),
    var(--paper);
}
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .035; 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='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.shell { width: min(100%, 760px); margin: auto; padding: max(24px, env(safe-area-inset-top)) 18px calc(34px + env(safe-area-inset-bottom)); }
.hero { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 2px 28px; }
.eyebrow, .section-label { font-size: 10px; letter-spacing: .17em; font-weight: 800; color: var(--green); }
.hero h1 { margin: 10px 0 0; font-family: "Unbounded", sans-serif; font-size: clamp(30px, 8.5vw, 56px); line-height: .98; letter-spacing: -.055em; }
.hero h1 span { color: var(--accent); }
.live-dot { display: flex; gap: 7px; align-items: center; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: .12em; background: rgba(255,255,255,.5); }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #32ac6d; box-shadow: 0 0 0 4px rgba(50,172,109,.13); }
.cabinet-card, .safety-card, .operation, .report, .admin-panel { border: 1px solid var(--line); border-radius: 24px; background: var(--card); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.cabinet-card { padding: 20px; margin-bottom: 14px; }
.cabinet-top, .section-heading { display: flex; align-items: center; justify-content: space-between; }
.cabinet-card h2 { margin: 16px 0 4px; font-size: 24px; letter-spacing: -.04em; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.icon-button { border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: white; cursor: pointer; font-size: 18px; }
.token-line { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.token-line b { color: var(--green); font-size: 9px; letter-spacing: .1em; }
.safety-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 18px 20px; }
.safety-copy h2 { margin: 7px 0 3px; font-size: 18px; letter-spacing: -.035em; }
.safety-copy p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.toggle-button { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-width: 108px; padding: 8px 10px; border: 0; border-radius: 999px; color: white; background: var(--green); cursor: pointer; transition: background .18s ease, opacity .18s ease; }
.toggle-button i { position: relative; width: 28px; height: 16px; border-radius: 999px; background: rgba(255,255,255,.32); }
.toggle-button i::after { content: ""; position: absolute; width: 12px; height: 12px; top: 2px; right: 2px; border-radius: 50%; background: white; transition: transform .18s ease; }
.toggle-button span { font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.toggle-button.is-off { background: #b4402a; }
.toggle-button.is-off i::after { transform: translateX(-12px); }
.toggle-button:disabled { opacity: .55; cursor: wait; }
.operation { position: relative; overflow: hidden; padding: 24px; color: white; background: var(--ink); }
.operation::after { content: ""; position: absolute; width: 180px; height: 180px; right: -75px; top: -95px; border: 38px solid rgba(201,239,117,.15); border-radius: 50%; }
.operation .section-label { color: var(--lime); }
.operation h2 { margin: 12px 0 7px; font-size: 24px; letter-spacing: -.04em; }
.operation p { max-width: 480px; margin: 0 0 22px; color: rgba(255,255,255,.62); font-size: 13px; line-height: 1.55; }
.primary-button, .stop-button, .download-button { position: relative; z-index: 1; width: 100%; min-height: 54px; border: 0; border-radius: 16px; cursor: pointer; font-weight: 800; }
.primary-button { display: flex; justify-content: space-between; align-items: center; padding: 0 18px; background: var(--lime); color: var(--ink); }
.primary-button i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: white; font-style: normal; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.stop-button { margin-top: 9px; background: rgba(255,255,255,.09); color: #ffad9b; border: 1px solid rgba(255,255,255,.12); }
.timer { position: absolute; right: 24px; top: 25px; color: var(--lime); font-family: "Unbounded"; font-size: 13px; }
.report { margin-top: 14px; padding: 22px 18px; }
.section-heading h2 { margin: 7px 0 0; font-size: 18px; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 800; cursor: pointer; }
.empty-state { margin-top: 18px; padding: 25px 18px; border-radius: 16px; border: 1px dashed var(--line); color: var(--muted); text-align: center; font-size: 13px; }
.report-overview { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; padding: 15px 6px; border-radius: 17px; background: var(--ink); color: white; }
.report-overview div { padding: 0 10px; border-right: 1px solid rgba(255,255,255,.12); }
.report-overview div:last-child { border-right: 0; }
.report-overview strong { display: block; font-family: "Unbounded"; color: var(--lime); font-size: 18px; letter-spacing: -.05em; }
.report-overview span { color: rgba(255,255,255,.55); font-size: 9px; }
.result-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 15px; }
.result-nav button { min-height: 72px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); text-align: left; background: rgba(255,255,255,.46); cursor: pointer; transition: .16s ease; }
.result-nav button span { font-size: 10px; font-weight: 800; }
.result-nav button strong { font-family: "Unbounded"; font-size: 18px; }
.result-nav button.active { color: white; background: var(--accent); border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 9px 22px rgba(255,90,54,.22); }
.result-detail { margin-top: 10px; padding: 19px 14px 14px; border-radius: 18px; background: rgba(23,33,29,.045); border: 1px solid var(--line); animation: reveal .24s ease both; }
.result-detail h3 { margin: 8px 0 0; font-family: "Unbounded"; font-size: 17px; letter-spacing: -.04em; }
.result-detail > p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.result-detail .primary-button { margin-top: 8px; }
.full-report { margin-top: 12px; }
.top-list { display: grid; gap: 7px; margin: 13px 0; }
.top-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 9px; align-items: center; padding: 10px; border-radius: 13px; background: white; }
.top-item > b { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--lime); font-size: 10px; }
.top-item div { min-width: 0; }
.top-item strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.top-item small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.top-item em { color: var(--accent); font-size: 10px; font-style: normal; font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 18px; }
.metric { min-height: 105px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border: 0; border-radius: 17px; color: var(--ink); text-align: left; background: rgba(23,33,29,.055); }
.metric-main { background: var(--accent); color: white; }
.metric span { font-size: 11px; font-weight: 700; opacity: .72; }
.metric strong { font-family: "Unbounded"; font-size: 26px; letter-spacing: -.05em; }
.metric small { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.metric-action { cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,90,54,.18); transition: transform .16s ease, background .16s ease; }
.metric-action:active { transform: scale(.98); background: rgba(255,90,54,.08); }
.warnings { margin-top: 12px; padding: 13px; border-radius: 14px; background: #fff2cb; color: #6f5411; font-size: 11px; line-height: 1.5; }
.download-row { display: grid; gap: 8px; margin-top: 12px; }
.download-button { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; background: var(--ink); color: white; }
.download-button.secondary { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.download-button span { font-size: 20px; }
.admin-panel { margin-top: 14px; padding: 20px; }
.queue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 15px; }
.queue-card { padding: 12px 9px; border-radius: 14px; background: rgba(23,33,29,.055); text-align: center; }
.queue-card b { display: block; margin-bottom: 4px; font-size: 18px; }
.queue-card span { color: var(--muted); font-size: 9px; }
dialog { width: min(calc(100% - 28px), 520px); padding: 0; border: 0; border-radius: 26px; color: var(--ink); background: #fffdf7; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(9,18,14,.56); backdrop-filter: blur(7px); }
dialog form { position: relative; padding: 28px 20px 20px; }
dialog h2 { margin: 10px 0 8px; font-family: "Unbounded"; font-size: 22px; }
dialog p { color: var(--muted); font-size: 12px; line-height: 1.55; }
dialog label { display: block; margin: 22px 0 8px; font-size: 11px; font-weight: 800; }
dialog textarea { width: 100%; resize: none; border: 1px solid var(--line); border-radius: 15px; padding: 13px; color: var(--ink); background: #f5f3ec; outline: none; font-size: 11px; }
dialog textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,54,.10); }
.dialog-close { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer; font-size: 22px; background: #eeeae0; }
.form-error { color: #a52d18; background: #ffe4dd; border-radius: 10px; padding: 10px; }
.category-count { display: flex; gap: 14px; align-items: center; margin: 22px 0; padding: 18px; border-radius: 18px; background: var(--ink); color: white; }
.category-count strong { font-family: "Unbounded"; color: var(--lime); font-size: 38px; letter-spacing: -.06em; }
.category-count span { color: rgba(255,255,255,.65); font-size: 11px; line-height: 1.45; }
.result-detail .download-button { margin: 18px 0 9px; }
.result-detail .form-error { margin-top: 12px; }
.category-empty { margin: 15px 0 4px; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.45); text-align: center; font-size: 12px; font-weight: 700; }
.is-loading { opacity: .55; pointer-events: none; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 500px); padding: 13px 16px; border-radius: 14px; background: var(--ink); color: white; box-shadow: var(--shadow); text-align: center; font-size: 12px; font-weight: 700; }
.skeleton { height: 22px; margin-top: 18px; border-radius: 9px; background: linear-gradient(90deg, #ebe8df 25%, #f8f6f0 45%, #ebe8df 65%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
.skeleton.wide { width: 72%; }
.reveal { opacity: 0; transform: translateY(10px); animation: reveal .5s ease forwards; }
.delay-1 { animation-delay: .07s; }.delay-2 { animation-delay: .14s; }.delay-3 { animation-delay: .21s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position: -300% 0; } }
@media (min-width: 620px) { .metric-grid { grid-template-columns: repeat(3, 1fr); } .download-row { grid-template-columns: repeat(3, 1fr); } .download-button { font-size: 11px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }
