:root {
  --ink: #f4f7ed;
  --muted: #9ca8a0;
  --soft: #c8d4c9;
  --bg: #0b1513;
  --panel: rgba(17, 30, 26, 0.8);
  --panel-strong: #13231e;
  --line: rgba(195, 221, 195, 0.14);
  --lime: #c8f284;
  --lime-dark: #9fc45d;
  --coral: #ff8a70;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 7%, rgba(106, 155, 110, 0.13), transparent 30rem),
    radial-gradient(circle at 89% 18%, rgba(255, 138, 112, 0.08), transparent 26rem),
    var(--bg);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button, a, label[tabindex] { outline-color: var(--lime); }

.shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; position: relative; z-index: 1; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 34px 0 26px; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 800; letter-spacing: -0.03em; }
.brand em { color: var(--lime); font-style: normal; font-weight: 500; }
.brand-mark { display: flex; gap: 3px; align-items: end; height: 23px; padding: 4px; border: 1px solid rgba(200, 242, 132, 0.5); border-radius: 7px; transform: rotate(-8deg); }
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--lime); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 12px; }
.brand-mark span:nth-child(3) { height: 16px; opacity: .8; }

.connection-pill { display: inline-flex; gap: 9px; align-items: center; color: var(--soft); border: 1px solid var(--line); padding: 8px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(200, 242, 132, .1); }

.tabs { display: flex; gap: 8px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); }
.tab-button { flex: 1; border: 0; border-radius: 7px; padding: 10px 15px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; transition: .2s ease; }
.tab-button:hover, .tab-button.active { background: rgba(200,242,132,.12); color: var(--lime); }

.intro { display: grid; grid-template-columns: 1fr; align-items: end; padding: 72px 0 82px; }
.eyebrow { margin: 0 0 17px; color: var(--lime); font: 500 10px/1.2 "DM Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 23px; max-width: 680px; font-size: clamp(45px, 7vw, 84px); line-height: .99; letter-spacing: -.075em; font-weight: 800; }
h1 span { color: var(--lime); }
.intro-copy { max-width: 450px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.url-card { padding: 20px 21px 17px; border: 1px solid rgba(200, 242, 132, .25); border-radius: 15px; background: linear-gradient(140deg, rgba(42, 64, 47, .65), rgba(18, 34, 27, .72)); box-shadow: var(--shadow); }
.url-card-label { display: flex; gap: 8px; align-items: center; color: var(--soft); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.wifi-icon { color: var(--lime); font-size: 21px; line-height: 0; transform: rotate(90deg); }
.url-row { display: flex; align-items: center; gap: 10px; margin-top: 15px; }
.url-row code { min-width: 0; overflow: hidden; color: var(--ink); font: 500 17px/1.4 "DM Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { flex: 0 0 auto; display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.04); color: var(--lime); cursor: pointer; font-size: 18px; transition: .2s ease; }
.icon-button:hover { border-color: var(--lime); background: rgba(200,242,132,.11); }
.url-hint { margin: 12px 0 0; color: var(--muted); font-size: 10px; }

.upload-panel, .gallery-section { border-top: 1px solid var(--line); padding: 38px 0 60px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 8px; }
h2 { margin-bottom: 0; color: var(--ink); font-size: clamp(24px, 4vw, 34px); letter-spacing: -.055em; }
.format-note { color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .09em; }

.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 295px; padding: 36px 20px; border: 1px dashed rgba(200, 242, 132, .4); border-radius: 18px; background: rgba(22, 42, 34, .47); cursor: pointer; text-align: center; transition: .25s ease; }
.drop-zone:hover, .drop-zone.is-dragging, .drop-zone:focus-visible { border-color: var(--lime); background: rgba(50, 76, 48, .5); box-shadow: 0 0 0 5px rgba(200, 242, 132, .06); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { display: grid; place-items: center; width: 55px; height: 55px; margin-bottom: 22px; border-radius: 17px; background: var(--lime); color: #1a2d1c; font-size: 29px; font-weight: 800; line-height: 1; }
.drop-title { color: var(--ink); font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.drop-subtitle { margin-top: 10px; color: var(--muted); font-size: 12px; }
.choose-button { display: inline-flex; gap: 12px; align-items: center; margin-top: 24px; padding: 11px 15px; border: 1px solid rgba(200,242,132,.35); border-radius: 8px; color: var(--lime); font-size: 12px; font-weight: 800; }
.choose-button span { font-size: 17px; }
.upload-status { min-height: 24px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.upload-status.success { color: var(--lime); }
.upload-status.error { color: var(--coral); }

.queue { display: grid; gap: 9px; }
.queue-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.queue-name { overflow: hidden; color: var(--soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.queue-progress { width: 112px; height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.queue-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime); transition: width .15s ease; }

.gallery-heading { align-items: center; }
.gallery-actions { display: flex; gap: 17px; align-items: center; }
.text-button, .download-all { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; text-decoration: none; }
.text-button:hover, .download-all:hover { color: var(--lime); }
.text-button span, .download-all span { margin-left: 4px; color: var(--lime); font-size: 16px; }
.count-badge { display: inline-grid; place-items: center; min-width: 23px; height: 23px; margin-left: 6px; padding: 0 6px; border-radius: 99px; background: rgba(200,242,132,.12); color: var(--lime); font: 500 11px "DM Mono", monospace; vertical-align: 4px; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.photo-card { position: relative; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-strong); }
.photo-preview { display: block; width: 100%; aspect-ratio: 1 / 1; background: #1b2a25; object-fit: cover; }
.photo-info { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 12px; }
.photo-name { min-width: 0; overflow: hidden; color: var(--soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.photo-tools { display: flex; gap: 7px; flex: 0 0 auto; }
.photo-tool { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: none; }
.photo-tool:hover { border-color: var(--lime); color: var(--lime); }
.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; padding: 30px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.018); text-align: center; }
.empty-art { display: flex; gap: 12px; margin-bottom: 19px; color: var(--lime); font-size: 20px; }
.empty-art span:nth-child(1) { transform: translateY(7px) rotate(-18deg); opacity: .55; }
.empty-art span:nth-child(3) { transform: translateY(7px) rotate(18deg); opacity: .55; }
.empty-state h3 { margin-bottom: 8px; font-size: 17px; letter-spacing: -.03em; }
.empty-state p { margin-bottom: 0; color: var(--muted); font-size: 12px; }

.devices-section { border-top: 1px solid var(--line); padding: 52px 0 60px; }
.access-required { margin: 38px 0 60px; padding: 30px; border: 1px dashed rgba(200,242,132,.35); border-radius: 15px; background: rgba(22,42,34,.35); }
.access-required h3 { margin-bottom: 9px; font-size: 19px; letter-spacing: -.04em; }
.access-required p:last-child { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.admin-login, .token-create-card, .token-result { padding: 25px; border: 1px solid var(--line); border-radius: 15px; background: rgba(22, 42, 34, .47); }
.admin-login { max-width: 680px; }
.admin-kicker { margin-bottom: 9px; color: var(--lime); font: 500 10px/1.2 "DM Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.admin-login h3, .token-create-card h3, .devices-list-heading h3 { margin-bottom: 8px; font-size: 18px; letter-spacing: -.04em; }
.admin-login p:not(.admin-kicker), .token-create-card p:not(.admin-kicker), .token-result p { margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-login code { color: var(--soft); font-family: "DM Mono", monospace; }
.admin-form, .token-form { display: grid; gap: 9px; }
.admin-form label, .token-form label { color: var(--soft); font-size: 11px; font-weight: 700; }
.admin-form-row { display: flex; gap: 9px; }
.admin-form-row input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; outline: 0; background: rgba(0,0,0,.18); color: var(--ink); font-size: 12px; }
.admin-form-row input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200,242,132,.08); }
.primary-button, .secondary-button { flex: 0 0 auto; border: 1px solid var(--lime); border-radius: 8px; padding: 10px 14px; cursor: pointer; font-size: 11px; font-weight: 800; }
.primary-button { background: var(--lime); color: #172719; }
.primary-button:hover { background: #d8fb9c; }
.secondary-button { background: transparent; color: var(--lime); }
.secondary-button:hover { background: rgba(200,242,132,.1); }
.admin-status { min-height: 20px; margin-top: 13px; color: var(--coral); font-size: 12px; }
.admin-panel { display: grid; gap: 28px; }
.token-create-card { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 30px; align-items: end; }
.token-create-card p { margin-bottom: 0 !important; }
.token-result { border-color: rgba(200,242,132,.35); background: rgba(50, 76, 48, .42); }
.token-result-content { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
.qr-frame { display: grid; gap: 9px; justify-items: center; color: var(--muted); font-size: 10px; text-align: center; }
.qr-code { display: block; width: 168px; height: 168px; padding: 9px; border-radius: 10px; background: #fff; image-rendering: pixelated; }
.qr-frame span { max-width: 190px; line-height: 1.5; }
.token-result-details { min-width: 0; }
.token-result-row { display: flex; gap: 9px; }
.token-result-row input { min-width: 0; flex: 1; border: 1px solid rgba(200,242,132,.25); border-radius: 8px; padding: 11px 12px; background: rgba(0,0,0,.18); color: var(--ink); font: 11px "DM Mono", monospace; }
.token-result p { margin: 12px 0 0; font-size: 10px; }
.devices-list-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.devices-list-heading h3 { margin-bottom: 0; }
.device-actions { display: flex; gap: 17px; align-items: center; }
.device-list { display: grid; gap: 11px; }
.device-card { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.device-card.revoked { opacity: .52; }
.device-card-main { min-width: 0; }
.device-card-actions { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.device-card-title { margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 800; }
.device-card-meta { color: var(--muted); font: 10px/1.7 "DM Mono", monospace; }
.device-card-token { margin-top: 8px; color: var(--lime); font: 10px "DM Mono", monospace; }
.device-card-status { margin-top: 6px; color: var(--coral); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.rename-button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: transparent; color: var(--soft); cursor: pointer; font-size: 10px; font-weight: 800; }
.rename-button:hover { border-color: var(--lime); color: var(--lime); }
.access-button { flex: 0 0 auto; border: 1px solid rgba(200,242,132,.35); border-radius: 8px; padding: 9px 11px; background: transparent; color: var(--lime); cursor: pointer; font-size: 10px; font-weight: 800; }
.access-button:hover { background: rgba(200,242,132,.1); }
.danger-button { flex: 0 0 auto; border: 1px solid rgba(255,138,112,.35); border-radius: 8px; padding: 9px 11px; background: transparent; color: var(--coral); cursor: pointer; font-size: 10px; font-weight: 800; }
.danger-button:hover { background: rgba(255,138,112,.1); }
.restore-button, .delete-button { flex: 0 0 auto; border: 1px solid rgba(200,242,132,.35); border-radius: 8px; padding: 9px 11px; background: transparent; color: var(--lime); cursor: pointer; font-size: 10px; font-weight: 800; }
.restore-button:hover { background: rgba(200,242,132,.1); }
.delete-button { border-color: rgba(255,138,112,.35); color: var(--coral); }
.delete-button:hover { background: rgba(255,138,112,.1); }
.device-empty { padding: 25px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); font-size: 12px; text-align: center; }

.footer { display: flex; justify-content: space-between; padding: 25px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.footer-brand span { padding: 0 4px; color: var(--lime); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: min(360px, calc(100% - 48px)); padding: 13px 16px; border: 1px solid rgba(200,242,132,.3); border-radius: 10px; background: #213b2a; color: var(--ink); box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,138,112,.4); background: #442820; }

.ambient { position: fixed; z-index: 0; width: 220px; height: 220px; border-radius: 50%; filter: blur(70px); opacity: .11; pointer-events: none; }
.ambient-one { top: 33%; left: -130px; background: var(--lime); }
.ambient-two { right: -130px; bottom: 8%; background: var(--coral); }

@media (max-width: 800px) {
  .shell { width: min(100% - 32px, 600px); }
  .intro { grid-template-columns: 1fr; gap: 30px; padding: 52px 0 58px; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .token-create-card { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 540px) {
  .topbar { padding-top: 22px; }
  .connection-pill { padding: 7px 9px; font-size: 9px; }
  .intro { padding-top: 42px; }
  h1 { font-size: clamp(43px, 14vw, 68px); }
  .section-heading, .gallery-heading { align-items: start; flex-direction: column; gap: 15px; }
  .format-note { display: none; }
  .gallery-heading { flex-direction: row; align-items: end; }
  .gallery-actions { flex-direction: column; align-items: end; gap: 5px; }
  .admin-form-row, .token-result-row { flex-direction: column; }
  .token-result-content { grid-template-columns: 1fr; justify-items: center; }
  .token-result-details { width: 100%; }
  .primary-button, .secondary-button { width: 100%; }
  .devices-list-heading { align-items: start; flex-direction: column; }
  .device-card { align-items: stretch; flex-direction: column; gap: 14px; }
  .device-card-actions { width: 100%; }
  .rename-button, .access-button, .danger-button, .restore-button, .delete-button { flex: 1; }
  .drop-zone { min-height: 265px; padding-left: 15px; padding-right: 15px; }
  .drop-title { font-size: 15px; }
  .drop-subtitle { max-width: 270px; line-height: 1.5; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .photo-info { padding: 9px; }
  .footer { gap: 20px; flex-direction: column; }
}
