/* Rack View giveaway: the app's look on the web. Golden pine rack, brushed
   metal faceplate, tape labels in marker, cobalt accents, LED meter. */
:root {
    --bg: #17181b;
    --bg-deep: #0e0f11;
    --ink: #17191c;
    --muted: #6d665b;
    --cobalt: #0a57ff;
    --led-on: #ffb347;
    --led-off: #3a2c1c;
    --green: #2e9b4f;
    --error: #b3261e;
    --tape: #efe6cf;
    --tape-edge: #d8ccad;
    --plate-a: #e6e2d8;
    --plate-b: #cfcac0;
    --gutter: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 0%, #26272b 0%, var(--bg) 45%, var(--bg-deep) 100%);
    color: var(--ink);
    font-family: Lexend, "Avenir Next", system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px var(--gutter) 32px;
}

/* Header: "rack view by IKIGAI" as in the app's title bar. */
.brand {
    width: 100%;
    max-width: 720px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 18px;
    position: relative;
}
.brand-word { font-weight: 700; font-size: 30px; letter-spacing: -0.5px; }
.brand-by { color: #5fb3d9; font-weight: 700; font-size: 22px; }
.brand-logo { height: 58px; width: auto; }
.lang { position: absolute; right: 0; display: flex; gap: 4px; }
.lang button {
    font: 600 12px Lexend, system-ui, sans-serif;
    color: #bbb;
    background: transparent;
    border: 1px solid #44464b;
    border-radius: 4px;
    padding: 4px 7px;
    cursor: pointer;
}
.lang button[aria-pressed="true"] { color: #fff; border-color: #5fb3d9; }

/* The rack: pine caps and ears around the faceplate. */
.rack { width: 100%; max-width: 720px; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55)); }
.rack-cap {
    height: 14px;
    background: url("assets/pine-cap.jpg") center / cover;
    border-radius: 6px;
    box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.25), inset 0 2px 2px rgba(255, 255, 255, 0.35);
}
.rack-body { display: flex; align-items: stretch; }
.rack-ear {
    width: 26px;
    flex: none;
    background: url("assets/pine-ear.jpg") center / cover;
    box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.25), inset 2px 0 2px rgba(255, 255, 255, 0.3);
}

/* Brushed metal plate. */
.plate {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 30px 34px 26px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, rgba(0, 0, 0, 0.025) 1px 3px),
        linear-gradient(180deg, var(--plate-a), var(--plate-b));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
.screw {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f4f4f4, #8d8d8d 60%, #5b5b5b);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
.screw::after {
    content: "";
    position: absolute;
    left: 2px; right: 2px; top: 5px;
    height: 2px;
    background: #4b4b4b;
    transform: rotate(-30deg);
}
.tl { top: 10px; left: 10px; } .tr { top: 10px; right: 10px; }
.bl { bottom: 10px; left: 10px; } .br { bottom: 10px; right: 10px; }

/* Masking tape with marker text. */
.tape {
    display: inline-block;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.025) 0 2px, transparent 2px 5px),
        var(--tape);
    border-left: 3px dotted var(--tape-edge);
    border-right: 3px dotted var(--tape-edge);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    font-family: Sriracha, "Marker Felt", cursive;
    color: #1d1d1d;
    transform: rotate(-1deg);
}
.tape-title { display: block; width: fit-content; margin: 0 auto 14px; padding: 4px 16px; }
.tape-title h1 { margin: 0; font: inherit; font-size: 22px; letter-spacing: 0.5px; }
.tape-small { padding: 1px 9px; font-size: 13px; }
.tape-green { background-color: #d6ecd2; }

.lead, .fine, .hint, .message { text-wrap: balance; }
.features li, .steps li, .thanks { text-wrap: pretty; }
.lead { text-align: center; color: #3b3832; margin: 0 0 6px; font-size: 16px; }
.platform { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 13px; letter-spacing: 0.2px; }

/* Thank-you screen with the power button to hold. */
.intro { display: flex; flex-direction: column; align-items: stretch; }
.intro[hidden], .main[hidden], .download[hidden] { display: none; }
.intro .thanks { margin: 0 0 16px; }
.intro-hint { text-align: center; margin: 4px 0 16px; font-size: 15px; color: #3b3832; text-wrap: balance; }
.power { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.power .leds { width: 100%; }
.power-button {
    --progress: 0;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: #5a5f68;
    background: radial-gradient(circle at 35% 30%, #fbfbfb, #b9b9b9 55%, #8a8a8a);
    box-shadow:
        0 0 0 5px #121314,
        0 0 0 8px rgba(10, 87, 255, calc(0.15 + var(--progress) * 0.85)),
        0 4px 10px rgba(0, 0, 0, 0.45),
        inset 0 -3px 6px rgba(0, 0, 0, 0.25);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: transform 0.12s ease, color 0.2s ease;
}
.power-button svg { width: 38px; height: 38px; display: block; margin: auto; }
.power-button:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 10px; }
.power-button.holding { transform: scale(0.96); color: var(--cobalt); }
.power-button.on {
    color: var(--led-on);
    cursor: default;
    box-shadow:
        0 0 0 5px #121314,
        0 0 0 8px var(--led-on),
        0 0 26px rgba(255, 179, 71, 0.8),
        inset 0 -3px 6px rgba(0, 0, 0, 0.25);
}
.main { animation: power-up 0.5s ease both; }
@keyframes power-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .main { animation: none; }
    .power-button { transition: none; }
}

.download { display: flex; flex-direction: column; animation: power-up 0.4s ease both; }
.download .key-button[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }

/* LED meter of the keys left. */
.meter { margin: 0 0 18px; }
.meter-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.meter-count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.leds {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 3px;
    padding: 6px;
    background: #121314;
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}
.led { height: 10px; border-radius: 2px; background: var(--led-off); }
.led.on { background: var(--led-on); box-shadow: 0 0 6px rgba(255, 179, 71, 0.75); }

.features {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 18px;
    font-size: 14px;
    color: #2d2b27;
}
.features li::before { content: "●"; color: var(--cobalt); margin-right: 7px; font-size: 10px; vertical-align: 2px; }

/* The claim form. */
.claim { display: flex; flex-direction: column; gap: 10px; }
.claim label { align-self: flex-start; }
.claim input {
    font: 16px Lexend, system-ui, sans-serif;
    padding: 11px 12px;
    border: 1px solid rgba(109, 102, 91, 0.55);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--ink);
}
.claim input:focus { outline: 2px solid var(--cobalt); outline-offset: 1px; }
.turnstile { min-height: 65px; }

.key-button {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    font: 600 16px Lexend, system-ui, sans-serif;
    color: #fff;
    background: linear-gradient(180deg, #2a2d33, #16181c);
    border: 1px solid #000;
    border-radius: 6px;
    padding: 12px 18px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 3px rgba(0, 0, 0, 0.35);
}
.key-button:hover { background: linear-gradient(180deg, #33373e, #1b1d22); }
.key-button:disabled { opacity: 0.5; cursor: default; }

.message { min-height: 1.3em; margin: 0; font-size: 14px; color: var(--ink); }
.message.error { color: var(--error); }

.result { display: flex; flex-direction: column; gap: 10px; }
.result[hidden], .claim[hidden], .key-button[hidden] { display: none; }
.result .tape { align-self: flex-start; }
.key-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #121314;
    border-radius: 5px;
    padding: 12px 14px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}
.key-display code {
    flex: 1;
    min-width: 0;
    color: var(--led-on);
    font: 600 20px ui-monospace, "SF Mono", Menlo, monospace;
    letter-spacing: 1px;
    overflow-wrap: anywhere;
    text-shadow: 0 0 8px rgba(255, 179, 71, 0.5);
}
.copy {
    font: 600 13px Lexend, system-ui, sans-serif;
    color: #fff;
    background: var(--cobalt);
    border: 0;
    border-radius: 4px;
    padding: 7px 12px;
    cursor: pointer;
}
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.steps { margin: 4px 0 6px; padding-left: 20px; font-size: 14px; color: #2d2b27; }
.steps li { margin: 3px 0; }

.thanks {
    margin: 6px 0 0;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
    color: #2d2b27;
    background: rgba(255, 255, 255, 0.45);
    border-left: 3px solid var(--cobalt);
    border-radius: 4px;
}
.fine { margin: 20px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.foot { color: #5c5e63; font-size: 12px; margin-top: 18px; }

@media (max-width: 760px) {
    .features { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .brand { flex-wrap: wrap; }
    .brand-word { font-size: 24px; }
    .lang { position: static; width: 100%; justify-content: center; margin-top: 6px; }
    .rack-ear { width: 14px; }
    .plate { padding: 26px 18px 22px; }
    .key-display { flex-direction: column; align-items: stretch; }
    .key-display code { font-size: 16px; text-align: center; }
    .features { font-size: 13px; }
    .platform span:not(.dot) { display: block; }
    .platform .dot { display: none; }
}
