/* The maker's side of y54.dev: home, editor and My codes. */

@font-face {
    font-family: "Lexend";
    src: url(/fonts/lexend.woff2) format("woff2");
    font-weight: 300 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f7f5f0;
    --ink: #242722;
    --text: #363e37;
    --muted: #687062;
    --line: #dedfd5;
    --field: #858e7d;
    --card: #fffefa;
    --accent: #427354;
    --accent-ink: #31583f;
    --accent-soft: #edf2e7;
    --danger: #c0392b;
    --navy: #12101f;
    --gold: #ffd23f;
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --read: "Lexend", Verdana, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 10px 30px rgba(17, 24, 39, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    font-family: var(--read);
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
canvas.pix { image-rendering: crisp-edges; image-rendering: pixelated; }

/* ---------- Top bar ---------- */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 24px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -.02em;
    color: var(--ink);
    text-decoration: none;
}
.logo svg { width: 28px; height: 28px; display: block; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a, .nav button {
    padding: 9px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}
.nav a:hover, .nav button:hover { color: var(--ink); background: rgba(17, 24, 39, .05); }
.nav a[aria-current="page"] { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1.5px solid var(--field);
    border-radius: 12px;
    background: var(--card);
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .2s ease, background-color .2s ease, transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:hover { border-color: #b9c1cc; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(40, 167, 69, .35); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(50, 90, 55, .12);
}
.btn.primary:hover:not(:disabled) { background: #365f45; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: rgba(17, 24, 39, .05); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: rgba(192, 57, 43, .45); }
.btn.icon { width: 40px; min-height: 40px; padding: 0; border-radius: 10px; }
.btn.google { gap: 12px; min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn.google svg { width: 20px; height: 20px; }

/* Pixel buttons, from the arcade on the Mr Nielsen page. */
.pix-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: 0;
    border-radius: 0;
    background: #1d1a33;
    box-shadow: inset -4px -4px 0 0 #0d0b18, inset 4px 4px 0 0 #3a3560, 0 0 0 4px var(--navy);
    color: #c9c6e0;
    transition: transform .12s ease, filter .2s ease;
}
.pix-btn:hover { filter: brightness(1.15); }
.pix-btn:active { transform: translateY(2px); }
.pix-btn:focus-visible { outline: 4px solid var(--gold); outline-offset: 4px; }
.pix-btn.gold {
    background: var(--gold);
    box-shadow: inset -4px -4px 0 0 #c99a00, inset 4px 4px 0 0 #fff2a8, 0 0 0 4px var(--navy);
}

/* ---------- Form controls ---------- */
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 18px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink); }
.input, .select, .textarea {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1.5px solid var(--field);
    border-radius: 12px;
    background: var(--card);
    font-size: 16px;
    color: var(--ink);
    outline: 0;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.textarea {
    min-height: 220px;
    padding: 14px;
    line-height: 1.7;
    font-weight: 300;
    resize: vertical;
}
.select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%238a94a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(40, 167, 69, .14);
}
.input.bad { border-color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Two or more choices in a pill row. */
.seg {
    display: inline-flex;
    padding: 4px;
    border-radius: 12px;
    background: rgba(17, 24, 39, .06);
    gap: 2px;
}
.seg button {
    min-height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(17, 24, 39, .12); }
.seg.big button { min-height: 44px; padding: 0 22px; font-size: 15px; }

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
    position: relative;
    flex: none;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #d6dbe3;
    transition: background-color .25s ease;
}
.switch .track::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .3s var(--ease-out);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(40, 167, 69, .2); }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 28px;
    background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #e3e7ee; }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #e3e7ee; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px; margin-top: -8px;
    border-radius: 50%; background: #fff; border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card h2 .switch { font-size: 14px; font-weight: 400; }

/* The QR card: white, in the arcade's navy and gold pixel frame. */
.qr-frame {
    position: relative;
    background: #fff;
    box-shadow: 0 0 0 4px var(--navy), 0 0 0 8px var(--gold), 0 0 0 12px var(--navy), 0 18px 50px rgba(18, 16, 31, .25);
}
.qr-frame canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }

.msg {
    min-height: 1.4em;
    font-size: 14px;
    color: var(--danger);
}
.msg.ok { color: var(--accent-ink); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    transform: translate(-50%, 20px);
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .4s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Home ---------- */
.home {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 80px);
    padding: 24px 16px 64px;
}
.home-inner { display: grid; justify-items: center; gap: 44px; }
.home .qr-frame { width: min(340px, 72vw); }
.home-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- Sign in ---------- */
.signin {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 160px);
    padding: 24px 16px;
}

/* ---------- My codes ---------- */
.mine {
    max-width: 1180px;
    margin: 0 auto;
    padding: 8px 24px 80px;
}
.mine-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 24px; flex-wrap: wrap; }
.mine-head h1 { font-size: 28px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.mine-local-notice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; margin-bottom: 28px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 12px; background: #f5f6ee; font-size: 13px; line-height: 1.6; color: var(--muted); }
.mine-local-notice a { color: var(--accent); text-underline-offset: 3px; }
.codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 22px;
}
.code-card { display: grid; gap: 14px; padding: 20px; }
.code-card + .code-card { margin-top: 0; }
.code-card .qr-frame { margin: 12px; }
.code-title { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-link { font: 500 14px/1.3 var(--mono); color: var(--accent-ink); text-decoration: none; }
.code-link:hover { text-decoration: underline; }
.code-owner { font-size: 12px; color: var(--muted); }
.code-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { display: grid; justify-items: center; gap: 20px; padding: 80px 0; }

/* ---------- 404 ---------- */
.lost {
    display: grid;
    place-items: center;
    gap: 24px;
    min-height: 80vh;
    text-align: center;
}
.lost h1 { font: 600 clamp(64px, 16vw, 140px)/1 var(--read); color: var(--ink); letter-spacing: -.04em; }

@media (max-width: 600px) {
    .top { padding: 14px 16px; }
    .card { padding: 20px 18px; border-radius: 16px; }
    .mine { padding: 8px 16px 64px; }
}

/* Shared studio identity. */
.top { max-width:1256px; border-bottom:1px solid var(--line); padding:24px 40px; }
.btn.primary { box-shadow:none; }
:focus-visible { outline:2px solid #789657; outline-offset:3px; }
@media(max-width:760px){.top{padding:18px 20px}.nav a,.nav button{font-size:11px;padding:8px}}

.logo .brand-wordmark { display: block; flex: none; width: 70px; height: 45px; stroke: none; }

/* Private unfinished designs alongside published codes. */
.mine-section + .mine-section { margin-top: 36px; }
.mine-section-title { margin: 0 0 17px; font-size: 16px; font-weight: 500; color: var(--ink); }
.draft-card { align-content: start; }
.lock-access-fields { margin-top: 28px; }
.lock-access-fields .field-hint { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.email-access-entry { display: flex; gap: 10px; }
.email-access-entry input { min-width: 0; flex: 1; }
.email-access-entry .btn { flex-shrink: 0; }
.email-access-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; list-style: none; }
.email-access-list li { display: flex; align-items: center; gap: 10px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 6px 12px; background: #f5f6ee; font-size: 14px; }
.email-access-list li span { overflow-wrap: anywhere; }
.email-access-list button { flex-shrink: 0; border: 0; background: none; color: var(--muted); width: 28px; height: 28px; cursor: pointer; font: 22px/1 var(--body); }
.email-access-list button:hover { color: var(--danger); }
.password-strength { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.password-strength meter { flex: 1; min-width: 60px; height: 12px; }
.password-strength span { min-width: 110px; }
.draft-badge { justify-self: start; padding: 4px 8px; border-radius: 6px; color: #62734d; background: #eaf0dc; font-size: 10px; line-height: 1.5; }
.draft-updated { color: var(--muted); font-size: 11px; }
