:root {
    --bg: #f2eee6;
    --card: #ffffff;
    --text: #2a241d;
    --muted: #7a6e60;
    --line: #e2dacb;
    --accent: #a5622a;
    --accent-dark: #874e1f;
    --head: #2a2018;
    --head-text: #f3e7d1;
    --brand: #f0c674;
    --ok-bg: #e7f4ea;
    --ok: #1f6236;
    --err-bg: #fbe9e9;
    --err: #9f2727;
    --gap: clamp(8px, 1.6vh, 14px);
    --in-h: clamp(36px, 5.2vh, 42px);
    --pad: clamp(14px, 2.6vh, 22px);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.top {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    background: var(--head);
}

.brand { color: var(--brand); font-size: 18px; font-weight: 700; text-decoration: none; }

.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }

.top nav a,
.navbtn {
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--head-text);
    font: inherit;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.top nav a:hover,
.top nav a.on,
.navbtn:hover { background: rgba(255, 255, 255, .12); }

.inline { display: inline; margin: 0; }

.wrap {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: clamp(10px, 3vh, 28px) 16px;
}

.wrap.wide { max-width: 940px; }

.card {
    padding: var(--pad);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}

h1 { margin: 0 0 var(--gap); font-size: clamp(18px, 2.6vh, 21px); }
h2 { margin: 0 0 var(--gap); font-size: clamp(16px, 2.4vh, 19px); }

form { margin: 0; }

.field { margin-bottom: var(--gap); }

label { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; }

input[type=text],
input[type=password] {
    width: 100%;
    height: var(--in-h);
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: inherit;
    font: inherit;
}

input:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -1px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row2 .field { margin-bottom: 0; }
.row2 + .row-note { margin: 4px 0 var(--gap); }
.row2:not(:has(+ .row-note)) { margin-bottom: var(--gap); }

.note { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }

.pw { position: relative; }
.pw input { padding-right: 42px; }

.eye {
    position: absolute;
    top: 50%;
    right: 5px;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    border: 0;
    border-radius: 6px;
    background: transparent no-repeat center / 19px 19px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6e60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    cursor: pointer;
}

.eye.on {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5622a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 19c-7 0-11-7-11-7a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 7 11 7a18.5 18.5 0 0 1-2.16 3.19M1 1l22 22'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3C/svg%3E");
}

.cap { display: flex; align-items: center; gap: 8px; }
.cap input { flex: 1; min-width: 0; letter-spacing: 3px; text-transform: uppercase; }
.cap img { flex: none; width: auto; height: var(--in-h); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }

.recap {
    flex: none;
    width: var(--in-h);
    height: var(--in-h);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

.recap:hover { color: var(--accent); border-color: var(--accent); }

.btn {
    display: inline-block;
    width: 100%;
    height: var(--in-h);
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover { background: var(--accent-dark); }
.btn.small { width: auto; height: auto; padding: 7px 14px; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn-download {
    position: relative;
    display: block;
    width: 100%;
    max-width: 360px;
    margin: var(--gap) auto 0;
    text-decoration: none;
    transition: transform .12s ease, filter .12s ease;
}
.btn-download img {
    display: block;
    width: 100%;
    height: auto;
}
.btn-download span {
    position: absolute;
    left: 0;
    right: 0;
    top: 66%;
    transform: translateY(-50%);
    text-align: center;
    color: #2b1404;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 1px 0 rgba(255, 232, 165, .75), 0 2px 4px rgba(105, 52, 8, .25);
    pointer-events: none;
}
.btn-download:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.btn-download:active {
    transform: translateY(1px);
}

.msg { margin-bottom: var(--gap); padding: 9px 12px; border-radius: 6px; font-size: 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); }

.hint { margin: var(--gap) 0 0; color: var(--muted); font-size: 13px; }
.hint a { color: var(--accent); }

.links { margin: var(--gap) 0 0; font-size: 14px; text-align: center; }
.links a { color: var(--accent); }

.muted { color: var(--muted); font-size: 13px; }

.tag { padding: 2px 8px; border-radius: 10px; font-size: 13px; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.no { background: var(--err-bg); color: var(--err); }

.acc { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 12px; }

.card.head { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.who { display: flex; align-items: center; gap: 12px; }

.avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--head);
    color: var(--brand);
    font-size: 18px;
    font-weight: 700;
}

.uname { font-size: 17px; font-weight: 700; word-break: break-all; }
.state { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }

.notice {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #f0d9a8;
    border-radius: 8px;
    background: #fff7e6;
    color: #7a5212;
    font-size: 13.5px;
}

.notice .btn.small { align-self: flex-start; }

.menu { display: flex; flex-direction: column; gap: 8px; }

.menu a {
    display: block;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
}

.menu a b { display: block; font-size: 15px; }
.menu a span { color: var(--muted); font-size: 13px; }
.menu a:hover { border-color: var(--accent); }
.menu a.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.menu a.on b { color: var(--accent); }

@media (max-width: 760px) {
    .wrap.wide { max-width: 520px; }
    .acc { grid-template-columns: 1fr; gap: 10px; }
    .side { gap: 10px; }
    .card.head { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
    .state { padding-top: 0; border-top: 0; }
    .notice { flex-direction: row; align-items: center; justify-content: space-between; }
    .notice .btn.small { align-self: auto; }
    .menu { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .wrap { justify-content: flex-start; padding: 10px 12px; }
    .brand { font-size: 16px; }
    .top { padding: 6px 12px; }
    .top nav a, .navbtn { padding: 5px 8px; font-size: 13px; }
    .row2 { grid-template-columns: 1fr; }
    .row2 .field + .field { margin-top: var(--gap); }
    .cap img { height: calc(var(--in-h) - 2px); }
    .menu a { padding: 8px 10px; }
    .menu a b { font-size: 14px; }
    .menu a span { font-size: 12px; }
    .card.head { padding: 10px 12px; }
    .avatar { width: 34px; height: 34px; font-size: 15px; }
    .uname { font-size: 15px; }
    .notice { padding: 8px 10px; font-size: 12.5px; }
}

@media (max-height: 640px) and (min-width: 481px) {
    .wrap { padding-top: 10px; padding-bottom: 10px; }
    label { margin-bottom: 2px; font-size: 13px; }
    .note { font-size: 12px; }
}

@media (max-width: 480px) and (max-height: 760px) {
    :root { --gap: 7px; --in-h: 34px; --pad: 12px; }
    .wrap { padding-top: 8px; padding-bottom: 8px; }
    h1, h2 { margin-bottom: 8px; font-size: 16px; }
    label { margin-bottom: 2px; font-size: 12.5px; }
    .note { margin-top: 2px; font-size: 11.5px; }
    .acc, .side { gap: 8px; }
    .menu a span { display: none; }
    .card.head { padding: 8px 12px; }
    .notice { padding: 6px 10px; font-size: 12px; }
    .msg { padding: 7px 10px; font-size: 13px; }
}

@view-transition { navigation: auto; }

.inv { visibility: hidden; }

.panes { display: grid; }

.pane {
    grid-area: 1 / 1;
    opacity: 1;
    transition: opacity .18s ease;
}

.pane:not(.on) { visibility: hidden; opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    .pane { transition: none; }
}

.top {
    width: min(calc(100% - 32px), 488px);
    margin: clamp(8px, 1.6vh, 14px) auto 0;
    border-radius: 10px;
}

.top.wide { width: min(calc(100% - 32px), 908px); }

@media (max-width: 760px) {
    .top.wide { width: min(calc(100% - 32px), 488px); }
}

@media (max-width: 480px) {
    .top, .top.wide { width: calc(100% - 24px); margin-top: 8px; }
}

body { justify-content: center; }
.wrap { flex: none; padding-top: 12px; }

@media (max-width: 480px) {
    body { justify-content: flex-start; }
    .wrap { padding-top: 8px; }
}

.steps { display: flex; gap: 6px; margin: 0 0 var(--gap); padding: 0; list-style: none; counter-reset: st; }

.steps li {
    flex: 1;
    padding: 6px 4px 6px 0;
    border-top: 3px solid var(--line);
    color: var(--muted);
    font-size: 12.5px;
    counter-increment: st;
}

.steps li::before { content: counter(st) ". "; }
.steps li.done { border-color: #c9a27c; }
.steps li.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.fp-acc {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: var(--gap);
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--bg);
    font-size: 14px;
}

.linkbtn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}
