/* ====================================================================
   Oracle 共通の見た目(トップページ以外のページで読み込む)
   トップページ(index.html)と同じ色・文字・形をそろえるためのもの。
   各ページの処理(ログイン・鑑定・保存など)には関わらない。
   ==================================================================== */
:root {
    --bg-color: #070a12;
    --night: #0b1020;
    --deep: #121a2e;
    --card-bg: linear-gradient(145deg, #121826 0%, #0b0f19 100%);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --gold-primary: #d4af37;
    --gold-pale: #f1d27a;
    --gold-gradient: linear-gradient(135deg, #f39c12 0%, #d4af37 50%, #f1c40f 100%);
    --border-color: rgba(212, 175, 55, 0.25);
    --border-highlight: rgba(212, 175, 55, 0.6);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(212, 175, 55, 0.05);
    --cinzel: 'Cinzel', 'Shippori Mincho', serif;
    --page-w: 760px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
html, body { overflow-x: clip; }
body {
    font-family: 'Shippori Mincho', "Times New Roman", serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.8;
}
a { color: var(--gold-primary); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--gold-pale);
    outline-offset: 3px;
}

/* ==================================================================== 星空(固定の背景) */
.sky {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background:
        radial-gradient(1px 1px at 12% 18%, rgba(226,232,240,.55) 50%, transparent 51%),
        radial-gradient(1px 1px at 27% 62%, rgba(226,232,240,.35) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 41% 33%, rgba(241,210,122,.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 58% 81%, rgba(226,232,240,.4) 50%, transparent 51%),
        radial-gradient(1px 1px at 69% 12%, rgba(226,232,240,.5) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 83% 47%, rgba(226,232,240,.35) 50%, transparent 51%),
        radial-gradient(1px 1px at 92% 76%, rgba(241,210,122,.45) 50%, transparent 51%),
        radial-gradient(1px 1px at 7% 88%, rgba(226,232,240,.3) 50%, transparent 51%),
        radial-gradient(1px 1px at 35% 93%, rgba(226,232,240,.3) 50%, transparent 51%),
        radial-gradient(1px 1px at 76% 30%, rgba(226,232,240,.3) 50%, transparent 51%),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.04) 0%, transparent 50%),
        var(--bg-color);
    background-size: 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 100% 100%, 100% 100%, 100% 100%;
}

/* ==================================================================== 上の帯 */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    display: flex; align-items: center; gap: 28px;
    height: 64px; padding: 0 32px;
    background: linear-gradient(180deg, rgba(7,10,18,.92) 0%, rgba(7,10,18,.6) 100%);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.14);
}
.topbar-logo {
    font-family: var(--cinzel); font-weight: 800; font-size: 1.45rem; letter-spacing: 3px;
    background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    text-decoration: none; white-space: nowrap;
}
.topbar nav { display: flex; gap: 22px; margin-left: 8px; }
.topbar nav a { color: var(--text-color); text-decoration: none; font-size: 0.92rem; letter-spacing: 1px; opacity: .85; white-space: nowrap; }
.topbar nav a:hover { color: var(--gold-pale); opacity: 1; }
.topbar-right { margin-left: auto; font-size: 0.88rem; display: flex; align-items: center; }
.topbar-right a { color: var(--gold-primary); text-decoration: none; white-space: nowrap; }
.topbar-right a:hover { color: var(--gold-pale); }
#auth-bar { margin-left: auto; font-size: 0.88rem; display: flex; align-items: center; white-space: nowrap; }
#auth-bar a { color: var(--gold-primary); text-decoration: none; margin-left: 18px; }
#auth-bar a:hover { color: var(--gold-pale); }
#auth-bar .auth-label { color: var(--text-muted); }

/* ==================================================================== ページのはじめ(星の輪と大きな見出し) */
.page-hero {
    position: relative; overflow: hidden;
    display: flex; align-items: flex-end;
    min-height: 400px; padding: 120px 6vw 96px;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%);
    background:
        radial-gradient(ellipse at 84% 42%, rgba(212,175,55,.11) 0%, transparent 48%),
        linear-gradient(160deg, rgba(18,26,46,.7) 0%, rgba(7,10,18,0) 60%);
}
.page-wheel {
    position: absolute; top: 50%; right: -150px;
    width: 640px; height: 640px; transform: translateY(-50%);
    pointer-events: none; opacity: .8;
}
.page-slash {
    position: absolute; left: -10vw; right: -10vw; bottom: 24%; height: 96px;
    transform: rotate(-7deg); transform-origin: center;
    background: linear-gradient(90deg, rgba(212,175,55,0) 0%, rgba(212,175,55,.08) 30%, rgba(212,175,55,.14) 62%, rgba(212,175,55,0) 100%);
    pointer-events: none;
    animation: ora-slash 1.1s cubic-bezier(.7,0,.2,1) .1s both;
}
.page-slash::before, .page-slash::after {
    content: ""; position: absolute; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, rgba(243,156,18,0) 0%, #d4af37 35%, #f1c40f 60%, rgba(241,196,15,0) 100%);
}
.page-slash::before { top: 0; }
.page-slash::after { bottom: 0; opacity: .45; height: 1px; }
.page-hero-inner { position: relative; z-index: 2; width: 100%; max-width: var(--page-w); margin: 0 auto; }
.page-kicker {
    margin: 0 0 12px .2em; color: var(--text-muted);
    font-size: .95rem; letter-spacing: .35em;
    animation: ora-fade 1s ease .35s both;
}
.page-title { margin: 0; font-weight: 800; }
.page-word {
    display: block; font-family: var(--cinzel); font-weight: 900; line-height: .86;
    font-size: clamp(3.4rem, 11vw, 8.6rem); letter-spacing: .02em; white-space: nowrap;
    color: transparent; -webkit-text-stroke: 1px rgba(212,175,55,.5);
    user-select: none;
    animation: ora-rise 1s cubic-bezier(.2,.8,.2,1) both;
}
.page-name {
    position: relative; display: block; margin: -.5em 0 0 .25em;
    font-size: clamp(1.5rem, 3.4vw, 2.3rem); letter-spacing: .2em; line-height: 1.35;
    color: var(--text-color); text-shadow: 0 2px 18px rgba(7,10,18,.95);
    animation: ora-rise 1s cubic-bezier(.2,.8,.2,1) .15s both;
}
@keyframes ora-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes ora-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ora-slash { from { transform: rotate(-7deg) scaleX(0); } to { transform: rotate(-7deg) scaleX(1); } }

/* 文書のページ(利用規約など)は控えめに */
.page-hero.doc {
    min-height: 0; padding: 116px 6vw 54px;
    clip-path: polygon(0 0, 100% 0, 100% 86%, 0 100%);
    background: linear-gradient(160deg, rgba(18,26,46,.6) 0%, rgba(7,10,18,0) 60%);
}
.page-hero.doc .page-word { font-size: clamp(2.8rem, 8vw, 5.6rem); -webkit-text-stroke-color: rgba(212,175,55,.38); }
.page-hero.doc .page-name { font-size: clamp(1.3rem, 2.8vw, 1.85rem); letter-spacing: .14em; }
.page-hero.doc .page-slash { bottom: 10%; height: 0; }
.page-hero.doc .page-slash::after { display: none; }

/* 星の輪(oracle-theme.js が描く) */
.deco-wheel { width: 100%; height: 100%; overflow: visible; display: block; }
.deco-wheel .rot { transform-origin: 0 0; animation: wheel-turn 360s linear infinite; }
@keyframes wheel-turn { to { transform: rotate(-360deg); } }
.deco-wheel .ring { fill: none; stroke: var(--gold-primary); }
.deco-wheel .tick { stroke: var(--gold-primary); }
.deco-wheel .glyph { fill: var(--gold-pale); font-family: 'Shippori Mincho', 'Segoe UI Symbol', serif; text-anchor: middle; dominant-baseline: central; }
.deco-wheel .aspect { stroke-width: 1.1; fill: none; }
.page-wheel .deco-wheel { animation: ora-fade 1.6s ease .2s both; }

/* ==================================================================== 本文 */
.container {
    position: relative; z-index: 2;
    width: 100%; max-width: calc(var(--page-w) + 36px);
    margin: 0 auto; padding: 6px 18px 0;
}
h2 {
    font-size: 1.2rem; color: var(--gold-primary);
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px; margin-top: 0; margin-bottom: 20px;
    display: flow-root; letter-spacing: .06em; line-height: 1.6; text-align: left;
}
h2::before { content: "✦"; font-size: 0.9rem; margin-right: 10px; vertical-align: 1px; }
h2 .en {
    float: right; margin: .5em 0 0 16px; line-height: 1.4;
    font-family: var(--cinzel); font-size: .7rem; font-weight: 600;
    letter-spacing: .22em; color: rgba(212,175,55,.6); text-transform: uppercase;
}

/* カード(元の見た目。モーダルなど本文の外で使う) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    position: relative;
}
.card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--gold-gradient); opacity: 0.7; border-radius: 8px 8px 0 0;
}
/* 本文のカードは、角を一つ切り落とした形(トップページの入力欄と同じ) */
main .card {
    border-radius: 0; padding: 32px 32px 28px; margin-bottom: 28px;
    clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%);
}
main .card::before { border-radius: 0; right: 26px; }
main .card::after {
    content: ""; position: absolute; top: 0; right: 0; width: 37px; height: 1px;
    background: var(--gold-primary); transform-origin: right top; transform: rotate(45deg); opacity: .7;
}

/* 入力 */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.inline-inputs { display: flex; gap: 10px; align-items: center; }
input, select, textarea {
    background: rgba(15, 23, 42, 0.8); border: 1px solid var(--border-color); color: var(--text-color);
    padding: 10px 12px; border-radius: 4px; font-family: inherit; font-size: 0.95rem; width: 100%; box-sizing: border-box;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-primary); box-shadow: 0 0 8px rgba(212, 175, 55, 0.3); }
input[type="checkbox"] { width: auto; accent-color: var(--gold-primary); }

/* ==================================================================== ボタン */
/* モーダルの中など(本文の外)は、トップページと同じ丸いボタン */
.btn-submit {
    width: 100%; background: var(--gold-gradient); color: #070a12; font-family: inherit; font-weight: bold; font-size: 1.05rem;
    padding: 14px; border: none; border-radius: 30px; cursor: pointer; letter-spacing: 2px; transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2); margin-top: 10px;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
    background: transparent; border: 1px solid var(--border-color); color: var(--gold-primary); margin-top: 15px;
    font-family: inherit; font-size: 0.95rem; padding: 12px 14px; border-radius: 30px; cursor: pointer; letter-spacing: 1px; width: 100%;
}
.btn-secondary:hover { background: rgba(212, 175, 55, 0.1); }

/* 本文のボタンは、トップページの「鑑定を実行」と同じ斜めの形 */
main .btn-submit {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 62px; padding: 10px 40px; margin-top: 16px;
    border-radius: 0; box-shadow: none;
    font-weight: 800; font-size: 1.08rem; letter-spacing: .16em; text-decoration: none;
    clip-path: polygon(20px 0, 100% 0, calc(100% - 20px) 100%, 0 100%);
    transition: transform .25s ease, filter .25s ease, background .25s ease;
}
main .btn-submit:hover { transform: translateX(6px); box-shadow: none; filter: brightness(1.07); }
main .btn-submit:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.6); }
main .btn-secondary {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 52px; padding: 8px 34px; border-radius: 0;
    background: rgba(212,175,55,.06); color: var(--gold-pale); letter-spacing: .1em; text-decoration: none;
    clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
    transition: transform .25s ease, background .25s ease;
}
main .btn-secondary:hover { background: rgba(212,175,55,.14); transform: translateX(5px); }
.btn-ghost { background: rgba(212,175,55,.06) !important; color: var(--gold-pale) !important; box-shadow: inset 0 0 0 1px rgba(212,175,55,.55) !important; }
.btn-ghost:hover { background: rgba(212,175,55,.14) !important; }
.btn-x { background: #000 !important; color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25) !important; }

.btn-back {
    display: flex; align-items: center; justify-content: center; text-align: center;
    width: fit-content; min-width: 260px; margin: 30px auto 0; min-height: 52px; padding: 8px 40px;
    background: rgba(212,175,55,.06); color: var(--gold-pale); box-shadow: inset 0 0 0 1px rgba(212,175,55,.55);
    border: none; font-family: inherit; font-size: .95rem; letter-spacing: .12em; text-decoration: none; cursor: pointer;
    clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
    transition: transform .25s ease, background .25s ease, filter .25s ease;
}
.btn-back:hover { transform: translateX(5px); background: rgba(212,175,55,.14); }
.btn-back.gold { background: var(--gold-gradient); color: #070a12; box-shadow: none; font-weight: 800; }
.btn-back.gold:hover { filter: brightness(1.07); }
.btn-toggle {
    background: rgba(212,175,55,.06); border: none; color: var(--gold-pale);
    box-shadow: inset 0 0 0 1px rgba(212,175,55,.5);
    padding: 9px 26px; font-family: inherit; font-size: 0.85rem; letter-spacing: .08em; cursor: pointer;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: background .2s ease;
}
.btn-toggle:hover { background: rgba(212,175,55,.16); }
.export-row { display: none; text-align: center; margin-top: 18px; gap: 12px; justify-content: center; flex-wrap: wrap; }
.export-upsell { display: none; text-align: center; margin-top: 18px; color: var(--text-muted); font-size: 0.85rem; }

/* ==================================================================== 読み込み中・エラー */
.loading { text-align: center; color: var(--gold-primary); padding: 40px 20px 60px; letter-spacing: .08em; }
.loading p { margin: 0; }
.loading-wheel { width: 150px; height: 150px; margin: 0 auto 22px; opacity: .9; }
.loading-wheel .deco-wheel .rot { animation-duration: 24s; }
.progress-bar-track {
    background: rgba(255, 255, 255, 0.08); height: 4px; overflow: hidden;
    margin: 18px auto 0; max-width: 320px;
}
.progress-bar-fill { height: 100%; background: var(--gold-gradient); width: 0%; transition: width 0.4s ease; box-shadow: 0 0 10px rgba(212,175,55,.6); }
.progress-status-text { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 12px; }
.error-msg {
    color: #f87171; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 3px solid #f87171; padding: 20px; line-height: 1.8; text-align: left;
}
.already-asked-note {
    text-align: center; color: var(--gold-pale); font-size: 0.85rem;
    background: rgba(212, 175, 55, 0.08); border: 1px solid var(--border-color);
    padding: 10px; margin-bottom: 18px;
}

/* ==================================================================== おわり */
.closing { padding: 90px 6vw 50px; }
.closing-inner { max-width: calc(var(--page-w) + 36px); margin: 0 auto; padding: 0 18px; }
.disclaimer { color: var(--text-muted); font-size: 0.82rem; line-height: 1.9; margin: 0 0 26px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 26px; font-size: .85rem; padding-top: 22px; border-top: 1px solid var(--border-color); }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--gold-primary); text-decoration: underline; }
.footer-mark { margin-top: 46px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.footer-mark b {
    font-family: var(--cinzel); font-weight: 900; font-size: clamp(2.4rem, 7vw, 4.2rem); letter-spacing: .06em; line-height: 1;
    background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.footer-mark small { color: var(--text-muted); font-size: .78rem; letter-spacing: .1em; }

/* ==================================================================== 画面の幅 */
@media (max-width: 900px) {
    .topbar { padding: 0 18px; gap: 16px; }
    .topbar nav { display: none; }
    .page-hero { min-height: 320px; padding: 100px 18px 80px; clip-path: polygon(0 0, 100% 0, 100% 86%, 0 100%); }
    .page-wheel { right: -220px; width: 520px; height: 520px; opacity: .5; }
    .page-hero.doc { padding: 100px 18px 44px; }
    .closing { padding: 80px 0 44px; }
}
@media (max-width: 520px) {
    .topbar-logo { font-size: 1.2rem; }
    #auth-bar { font-size: .82rem; }
    #auth-bar a { margin-left: 12px; }
    .page-hero { min-height: 280px; }
    .page-wheel { right: -260px; width: 480px; height: 480px; }
    .page-name { letter-spacing: .12em; }
    main .card { padding: 26px 20px 22px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%); }
    main .card::before { right: 18px; }
    main .card::after { width: 26px; }
    .inline-inputs { gap: 6px; }
    main .btn-submit { padding: 10px 24px; letter-spacing: .08em; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); }
    .btn-back { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .deco-wheel .rot, .page-slash, .page-word, .page-name, .page-kicker, .page-wheel .deco-wheel { animation: none !important; }
}

/* ==================================================================== 印刷・PDF(白地にする) */
@media print {
    :root { --text-color: #111827; --text-muted: #4b5563; }
    .sky, .topbar, .page-wheel, .page-slash, .page-word, .closing, .loading-wheel { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .page-hero { min-height: 0 !important; padding: 0 0 14px !important; clip-path: none !important; background: none !important; display: block; }
    .page-kicker { color: #444 !important; letter-spacing: .2em; margin: 0; animation: none; }
    .page-name { margin: 0 !important; color: #000 !important; text-shadow: none !important; font-size: 18pt !important; letter-spacing: .1em !important; animation: none; }
    main .card { clip-path: none !important; }
    main .card::after { display: none !important; }
}
