:root {
    /* Yozai web font (loaded by fonts.js); system fonts until it arrives. */
    font-family: "Yozai", ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
    color: #141414;
    background: #ffffff;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    --accent: #2f6bff;
    --accent-dark: #1d4ed8;
    --accent-soft: #eaf2ff;
    --surface: #ffffff;
    --border: #ececec;
    --muted: #808080;
    --success: #2f9e5b;
    --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: radial-gradient(90% 55% at 90% 0, #dbeafe 0, transparent 70%), radial-gradient(80% 45% at 0 100%, #e0f2fe 0, transparent 70%), linear-gradient(180deg, #f8fbff, #ffffff 50%, #f6faff); }
main { width: 100%; max-width: 480px; margin: auto; }
/* Top bar and card form one block, centered vertically on every screen size. */
.topbar { margin-top: auto; }
.topbar + main { margin-top: 0; margin-bottom: auto; }
.topbar, main { width: 100%; max-width: 480px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #93b8fb; outline-offset: 2px; }
p { line-height: 1.65; }

/* Top bar: brand on the left, help links on the right. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 4px; margin-bottom: 16px; animation: rise .5s var(--ease) both; }
.brand { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .2px; color: #141414; }
.logo { display: block; width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 3px 8px #2a1a2033; }
.top-actions { display: flex; gap: 8px; }
.top-actions button { display: inline-flex; align-items: center; gap: 5px; width: auto; min-height: 36px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: #222222; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px #0000000d; white-space: nowrap; }
.top-actions button svg { color: var(--accent); }
.top-actions button:hover { background: var(--accent-soft); border-color: #bcd3fb; }


/* Card with a vertical stepper. */
.card, form { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 24px 22px; box-shadow: 0 1px 2px #0000000a, 0 12px 32px #00000014; }
form { animation: rise .6s var(--ease) .12s both; }
.step-item { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 14px; padding-bottom: 24px; }
.step-item:last-child { padding-bottom: 0; }
.step-item:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 36px; bottom: 6px; width: 2px; border-radius: 2px; background: linear-gradient(var(--border), #f1f1f1); }
.step { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 14px; font-weight: 800; box-shadow: inset 0 0 0 1px #cfe0fd; transition: background-color .3s, color .3s, box-shadow .3s; }
.step-item:has(#udid:not(:placeholder-shown)) .step { background: var(--success); color: transparent; box-shadow: none; position: relative; }
.step-item:has(#udid:not(:placeholder-shown)) .step::after { content: ""; position: absolute; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); animation: pop .35s var(--ease); }
.step-body { min-width: 0; }
label, .step-label { display: block; margin: 4px 0 12px; font-size: 16px; font-weight: 700; color: #141414; line-height: 1.4; }
.field-hint { margin: 8px 0 0; padding: 0 2px; font-size: 13px; line-height: 1.6; color: var(--muted); }

input, select, button, .button { font: inherit; width: 100%; min-height: 50px; border-radius: 14px; }
input, select { padding: 12px 15px; border: 1px solid var(--border); background: #ffffff; color: #141414; transition: border-color .2s, box-shadow .2s, background-color .2s; }
input::placeholder { color: #a3a3a3; opacity: 1; }
input:focus { border-color: var(--accent); background: #fff; outline: none; box-shadow: 0 0 0 4px #2f6bff24; }
#udid:not(:placeholder-shown) { border-color: #a8dcbb; background: #f1faf4; color: #1f6b3e; font-size: 15px; letter-spacing: .2px; animation: filled .6s var(--ease); }
button, .button { display: block; text-align: center; padding: 12px 16px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-weight: 700; text-decoration: none; transition: background-color .2s, border-color .2s, box-shadow .2s, transform .15s var(--ease); }
button:hover, .button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .6; cursor: wait; }
#device:disabled { cursor: not-allowed; background: #bcd3fb; border-color: #bcd3fb; color: #fff; }
.udid-row { display: flex; align-items: stretch; gap: 8px; }
.udid-row input { min-width: 0; flex: 1; }
.udid-row button:not(:disabled) { border: 0; background: linear-gradient(135deg, #4fa8ff, var(--accent-dark)); box-shadow: 0 6px 14px #2f6bff33; }
.udid-row button { display: flex; align-items: center; justify-content: center; gap: 4px; width: auto; flex: 0 0 auto; padding: 10px 14px; white-space: nowrap; }

#submit { position: relative; overflow: hidden; min-height: 54px; font-size: 17px; letter-spacing: 1px; border: 0; background: linear-gradient(135deg, #4fa8ff, var(--accent-dark)); box-shadow: 0 8px 20px #2f6bff3d; }
#submit:hover { box-shadow: 0 10px 26px #2f6bff55; transform: translateY(-1px); }
#submit:active { transform: scale(.97); }
.site-footer { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--muted); animation: rise .6s var(--ease) .2s both; }

dialog { width: min(340px, calc(100% - 40px)); border: 0; border-radius: 22px; padding: 26px 22px 22px; color: #141414; background: var(--surface); text-align: center; box-shadow: 0 24px 64px #00000038; }
dialog[open] { animation: pop .28s var(--ease); }
dialog::backdrop { background: #11111152; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s ease; }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dialog p { margin: 0 0 22px; line-height: 1.7; overflow-wrap: anywhere; color: #444444; }
dialog button { min-height: 48px; }
#notice-message { white-space: pre-line; text-align: left; }

/* Reviews dialog */
#reviews-dialog { width: min(560px, calc(100% - 32px)); padding: 22px 18px 18px; }
#reviews-dialog .review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; max-height: min(64vh, 620px); overflow-y: auto; overscroll-behavior: contain; margin: 0 0 16px; padding: 2px; text-align: left; }
.review-card { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: #fff; padding: 8px; }
.review-photo { position: relative; overflow: hidden; display: block; width: 100%; aspect-ratio: 1; border-radius: 11px; background: var(--accent-soft); }
.review-photo img { position: absolute; width: 235.5%; height: auto; max-width: none; }
.review-card p { margin: 8px 4px 4px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; color: #141414; }
.review-card p::before { content: "★★★★★"; display: block; margin-bottom: 2px; color: #ffb02e; font-size: 12px; letter-spacing: 1px; }
.review-card:nth-child(1) img { left: -10.0%; top: -167.5%; }
.review-card:nth-child(2) img { left: -125.0%; top: -167.5%; }
.review-card:nth-child(3) img { left: -10.0%; top: -337.5%; }
.review-card:nth-child(4) img { left: -125.0%; top: -337.5%; }
.review-card:nth-child(5) img { left: -10.0%; top: -175.0%; }
.review-card:nth-child(6) img { left: -125.0%; top: -175.0%; }
.review-card:nth-child(7) img { left: -10.0%; top: -355.0%; }
.review-card:nth-child(8) img { left: -125.0%; top: -350.0%; }
.review-card:nth-child(9) img { left: -10.0%; top: -187.5%; }
.review-card:nth-child(10) img { left: -125.0%; top: -175.0%; }
.review-card:nth-child(11) img { left: -10.0%; top: -352.5%; }
#reviews-close { background: #f0f0f0; border-color: #f0f0f0; color: #141414; }
#reviews-close:hover { background: #e4e4e4; border-color: #e4e4e4; }
#notice-copy { margin-bottom: 10px; }
#notice-close { background: #f0f0f0; border-color: #f0f0f0; color: #141414; }
#notice-close:hover { background: #e4e4e4; border-color: #e4e4e4; }

/* Install page */
.card { animation: rise .55s var(--ease) both; }
h1 { font-size: 24px; line-height: 1.35; margin: 12px 0; }
.install-ready { text-align: center; }
.ready-mark { width: 76px; height: 76px; color: var(--success); margin: 8px 0 12px; animation: pop .45s var(--ease); }
.install-ready h1 { margin: 0 0 16px; }
.install-steps { margin: 0 0 22px; padding: 14px 18px 14px 36px; text-align: left; font-size: 14px; line-height: 1.9; color: #444444; background: #f7f7f7; border: 1px solid var(--border); border-radius: 14px; }
.install-steps li::marker { color: var(--accent); font-weight: 700; }
.install-guide { color: #444444; background: var(--surface); border: 1px solid var(--border); margin: 14px 0 6px; padding: 12px 20px; }
.install-guide:hover { background: var(--accent-soft); border-color: #bcd3fb; }
.back-link { color: var(--accent-dark); display: inline-block; padding: 12px; min-height: 44px; }
.spinner { width: 40px; height: 40px; margin: 0 auto 18px; border: 4px solid #ececec; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes filled { from { box-shadow: 0 0 0 0 #2f9e5b40; } to { box-shadow: 0 0 0 10px #2f9e5b00; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones: the three help buttons get their own row under the brand. */
@media (max-width: 520px) {
    body { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
    .topbar { flex-wrap: wrap; row-gap: 10px; margin-bottom: 14px; }
    .brand { font-size: 16px; gap: 7px; }
    .logo { width: 26px; height: 26px; border-radius: 7px; }
    .top-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .top-actions button { justify-content: center; gap: 4px; min-height: 34px; padding: 4px; font-size: 13px; }
    .top-actions button svg { width: 14px; height: 14px; }
    /* Compact card: smaller labels and controls; inputs stay 16px so Safari does not zoom on focus. */
    .card, form { padding: 18px 16px; border-radius: 18px; }
    .step-item { grid-template-columns: 24px minmax(0, 1fr); column-gap: 10px; padding-bottom: 16px; }
    .step-item:not(:last-child)::before { left: 11px; top: 30px; bottom: 4px; }
    .step { width: 24px; height: 24px; font-size: 12px; }
    .step-item:has(#udid:not(:placeholder-shown)) .step::after { width: 8px; height: 5px; border-width: 0 0 2px 2px; }
    label, .step-label { margin: 1px 0 8px; font-size: 15px; }
    input, select { min-height: 42px; padding: 8px 12px; border-radius: 12px; font-size: 16px; }
    #udid:not(:placeholder-shown) { font-size: 16px; letter-spacing: 0; }
    .udid-row { gap: 6px; }
    .udid-row button { min-height: 42px; padding: 6px 12px; border-radius: 12px; font-size: 14px; }
    .field-hint { margin-top: 5px; font-size: 12px; line-height: 1.5; }
    #submit { min-height: 46px; border-radius: 12px; font-size: 16px; letter-spacing: 1px; }
    .site-footer { margin-top: 12px; font-size: 12px; }
}
@media (max-width: 380px) {
    body { padding-left: 12px; padding-right: 12px; }
    .top-actions button { padding: 4px 2px; gap: 3px; font-size: 12px; }
    .card, form { padding: 16px 12px; }
    .step-item { column-gap: 8px; }
}
/* iPad and landscape: same single column, a little roomier. */
@media (min-width: 700px) {
    .topbar, main { max-width: 560px; }
    .card, form { padding: 30px 30px; }
}
@media (min-width: 700px) and (orientation: landscape) and (max-height: 900px) {
    .step-item { padding-bottom: 18px; }
    .site-footer { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, dialog::backdrop { animation: none !important; transition: none !important; }
}

/* Headings and buttons use the Medium cut instead of synthesized bold. */
.brand, .logo, label, .step-label, .step, button, .button, dialog h2, h1 { font-family: "Yozai Medium", "Yozai", ui-rounded, -apple-system, "PingFang SC", sans-serif; font-synthesis: none; }
