@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100..900&display=swap');

:root {
    --commons: #8c1f28;
    --commons-deep: #5e1219;
    --commons-bright: #b04048;
    --mint: #d9eee4;
    --cream: #f6f2e8;
    --paper: #fffdf8;
    --ink: #13241e;
    --muted: #66746e;
    --line: rgba(140, 31, 40, 0.15);
    --gold: #d7ad52;
    --danger: #b74435;
    --shadow: 0 24px 70px rgba(94, 18, 25, 0.14);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--cream); line-break: strict; overflow-wrap: anywhere; word-break: normal; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 15%, rgba(176, 64, 72, 0.11), transparent 28rem),
        radial-gradient(circle at 90% 88%, rgba(215, 173, 82, 0.12), transparent 25rem),
        var(--cream);
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: var(--commons); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.page-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 clamp(18px, 4vw, 64px); }

.site-header {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
    font-size: 1.14rem;
    letter-spacing: 0;
}

.brand strong { color: var(--commons); }

.brand-mark {
    width: 36px;
    height: 36px;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    justify-content: center;
    padding: 8px 7px;
    border-radius: 50% 50% 44% 44%;
    background: var(--commons);
}

.brand-mark span { width: 5px; border-radius: 3px 3px 0 0; background: var(--cream); }
.brand-mark span:nth-child(1) { height: 11px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; }

.quiet-button {
    border: 0;
    border-bottom: 1px solid currentColor;
    padding: 5px 0;
    background: transparent;
    color: var(--commons);
    cursor: pointer;
    font-weight: 600;
}

main { padding: clamp(28px, 5vw, 72px) 0 32px; }

.game-panel {
    overflow: hidden;
    border: 1px solid rgba(140, 31, 40, 0.12);
    border-radius: 28px;
    background: rgba(255, 253, 248, 0.94);
    box-shadow: var(--shadow);
}

.game-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    padding: clamp(26px, 4vw, 54px);
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--commons-bright);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1, h2 { font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-weight: 900; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(1.6rem, 3.6vw, 3.4rem); line-height: 1.25; letter-spacing: 0; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.8rem, 4vw, 3rem); }

.stats { display: flex; gap: 10px; flex: 0 0 auto; }
.stats-block { display: flex; flex: 0 0 auto; flex-direction: column; gap: 9px; }
.stat { min-width: 112px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.stat-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.stat strong { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat-total { color: var(--muted); font-size: 0.75em; font-weight: 500; }
.timer-stat { background: var(--commons); color: white; border-color: var(--commons); }
.timer-stat .stat-label { color: rgba(255,255,255,.7); }
.timer-stat.urgent { background: var(--danger); border-color: var(--danger); animation: timer-pulse 1s infinite; }
.end-game-button { width: 100%; border: 0; border-radius: 10px; padding: 7px 12px; background: transparent; color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; transition: color .18s ease, background .18s ease; }
.end-game-button:hover { background: rgba(140, 31, 40, .07); color: var(--commons); }
.end-game-button:focus-visible { outline: 2px solid var(--commons-bright); outline-offset: 2px; }

.play-grid { display: grid; grid-template-columns: 1fr; }
.play-grid.is-playing { grid-template-columns: minmax(340px, 0.86fr) minmax(460px, 1.14fr); }
.recall-column { padding: clamp(28px, 4vw, 54px); }

.start-card { max-width: 100%; padding-top: 0; display: grid; grid-template-columns: 1fr; gap: 26px; }
@media (min-width: 881px) {
    .start-card { grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr); align-items: center; gap: clamp(28px, 4vw, 64px); }
    .home-photo img { max-height: 430px; object-position: center; }
}
.start-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.lead-copy { max-width: 46em; line-height: 1.9; margin: 0; }
footer { padding: 8px 0 38px; color: var(--muted); font-size: .7rem; text-align: center; }
footer p { margin: 2px auto; max-width: none; line-height: 1.6; padding: 0 12px; }
.home-photo { margin: 0; }
.home-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4000 / 2873; object-fit: cover; border-radius: 18px; box-shadow: 0 18px 45px rgba(94, 18, 25, .18); }
.home-photo figcaption { margin-top: 8px; color: var(--muted); font-size: .68rem; }
.start-kicker { margin: 0 0 14px; color: var(--commons); font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: clamp(1.65rem, 3vw, 2.45rem); font-weight: 900; letter-spacing: 0; }
.start-card > p:not(.data-note, .subscribe-invitation) { color: var(--muted); line-height: 1.7; }
.mode-picker { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.mode-picker legend { margin-bottom: 8px; color: var(--commons); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mode-picker label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; font-size: .88rem; font-weight: 600; }
.mode-picker label:has(input:checked) { border-color: var(--commons); background: var(--mint); }
.mode-picker input { accent-color: var(--commons); }

.primary-button, .secondary-button {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    border: 0;
    border-radius: 13px;
    padding: 0 22px;
    cursor: pointer;
    font-weight: 700;
    transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.primary-button { background: var(--commons); color: white; box-shadow: 0 10px 25px rgba(140, 31, 40, .2); }
.primary-button:hover:not(:disabled) { background: var(--commons-deep); transform: translateY(-2px); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--commons); }
.full-button { width: 100%; }
.start-card .primary-button { margin-top: 0; }
.data-note { margin-top: 14px; color: var(--muted); font-size: .75rem; }
.error-text { color: var(--danger); }
.subscribe-invitation { margin: 25px 0 10px; color: var(--commons); font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.newsletter-embed { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.newsletter-embed iframe { display: block; width: 100%; max-width: 100%; height: 320px; border: 0; background: white; }
.home-newsletter { margin-top: 0; }

.guess-area > label { display: block; margin-bottom: 10px; color: var(--commons); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.input-wrap { position: relative; }
.input-wrap input {
    width: 100%;
    min-height: 66px;
    border: 2px solid rgba(140, 31, 40, .25);
    border-radius: 14px;
    outline: none;
    padding: 0 58px 0 20px;
    background: white;
    color: var(--ink);
    font-size: clamp(1rem, 2.2vw, 1.22rem);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.input-wrap input:focus { border-color: var(--commons-bright); box-shadow: 0 0 0 5px rgba(176, 64, 72, .1); }
.input-tick { position: absolute; top: 50%; right: 19px; display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--commons-bright); color: white; opacity: 0; transform: translateY(-50%) scale(.5); }
.input-wrap.correct .input-tick { animation: correct-pop .6s ease; }
.input-wrap.correct input { animation: correct-border .6s ease; }
.guess-feedback { min-height: 22px; margin: 9px 0 25px; color: var(--muted); font-size: .78rem; }

.named-panel { border-top: 1px solid var(--line); padding-top: 20px; }
.named-heading { display: flex; align-items: baseline; justify-content: space-between; }
.named-heading h2 { margin: 0; font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.named-heading span { color: var(--muted); font-size: .75rem; }
.named-empty { margin-top: 20px; padding: 24px 14px; border: 1px dashed rgba(13,79,60,.24); border-radius: 12px; color: var(--muted); font-size: .82rem; text-align: center; }
.named-list { max-height: 242px; margin: 14px 0 0; padding: 0; overflow: auto; list-style: none; scrollbar-width: thin; }
.named-item { display: grid; grid-template-columns: 42px 1fr 8px; gap: 11px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--line); animation: item-in .35s ease both; }
.named-item img { width: 42px; height: 42px; object-fit: cover; border-radius: 50%; background: var(--mint); }
.named-item strong, .named-item small, .named-item em { display: block; }
.named-item strong { font-size: .84rem; }
.named-item small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.named-item em { margin-top: 2px; color: var(--commons-bright); font-size: .66rem; font-style: normal; font-weight: 600; }
.named-item i { width: 7px; height: 28px; border-radius: 5px; background: var(--party-colour); }

.memory-cloud {
    position: relative;
    min-height: 470px;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(94, 18, 25, .97), rgba(140, 31, 40, .93)),
        var(--commons);
    color: white;
}
.memory-cloud::after { content: ""; position: absolute; inset: 0; opacity: .1; background-image: radial-gradient(circle at center, white 1px, transparent 1px); background-size: 23px 23px; pointer-events: none; }
.cloud-copy { position: absolute; z-index: 5; top: 25px; left: 28px; display: flex; gap: 9px; align-items: center; color: rgba(255,255,255,.75); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #89dfb5; box-shadow: 0 0 0 5px rgba(137, 223, 181, .12); }
.portrait-credit { position: absolute; z-index: 5; right: 20px; bottom: 15px; margin: 0; color: rgba(255,255,255,.45); font-size: .62rem; }
.portrait-credit a { color: inherit; }
.portrait-stage { position: absolute; inset: 60px 20px 34px; opacity: 1; transition: opacity .25s ease, transform .25s ease; }
.portrait-stage.changing { opacity: 0; transform: scale(.98); }
.cloud-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: rgba(255,255,255,.55); font-size: .78rem; }
.placeholder-head { position: relative; width: 68px; height: 68px; border: 1px dashed rgba(255,255,255,.35); border-radius: 50%; }
.placeholder-head::before { content: ""; position: absolute; top: 14px; left: 24px; width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.22); }
.placeholder-head::after { content: ""; position: absolute; left: 15px; bottom: 11px; width: 36px; height: 19px; border-radius: 50% 50% 40% 40%; background: rgba(255,255,255,.22); }
.orbit { position: absolute; z-index: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; }
.orbit-one { width: 390px; height: 390px; top: 45px; left: 12%; }
.orbit-two { width: 260px; height: 260px; right: -45px; bottom: -70px; }
.portrait-bubble { position: absolute; z-index: 2; left: var(--bubble-x); top: var(--bubble-y); width: var(--bubble-size); height: var(--bubble-size); overflow: hidden; border: 4px solid rgba(255,255,255,.86); border-radius: 50%; background: var(--mint); box-shadow: 0 18px 45px rgba(0,0,0,.28), 0 0 0 8px color-mix(in srgb, var(--party-colour) 55%, transparent); animation: float-a var(--float-duration) ease-in-out var(--float-delay) infinite; transition: opacity .4s ease, transform .4s ease, left .35s ease, top .35s ease; }
.portrait-bubble img { width: 100%; height: 100%; object-fit: cover; object-position: center top; user-select: none; }
.portrait-bubble.is-guessed { opacity: 0; transform: scale(.55); }

footer { padding: 8px 0 38px; color: var(--muted); font-size: .7rem; text-align: center; }
footer p { margin: 2px auto; max-width: none; line-height: 1.6; padding: 0 12px; }
.privacy-note { opacity: .9; }

/* Keep Safari's search-field behaviour without its decorative controls. */
#guessInput::-webkit-search-cancel-button,
#guessInput::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.modal { width: min(520px, calc(100% - 28px)); max-width: none; max-height: calc(100dvh - 28px); overflow: auto; border: 0; border-radius: 23px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(46, 8, 12, .35); }
.modal::backdrop { background: rgba(46, 8, 12, .66); backdrop-filter: blur(5px); }
.modal-inner { position: relative; padding: clamp(28px, 6vw, 48px); }
.modal-inner h2 { margin: 0 0 12px; line-height: 1; }
.modal-inner > p:not(.eyebrow, .copy-feedback, .result-detail) { color: var(--muted); line-height: 1.6; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--mint); cursor: pointer; font-size: 1.45rem; line-height: 1; }
.rules-list { margin: 24px 0; padding-left: 22px; }
.rules-list li { margin: 11px 0; padding-left: 5px; line-height: 1.5; }
.results-inner { text-align: center; }
.result-seal { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 23px; border-radius: 50%; background: var(--commons); color: white; font-size: 1.5rem; box-shadow: 0 0 0 10px var(--mint); }
.result-subtitle { margin: 0 auto 25px; max-width: 390px; }
.result-meter { height: 10px; overflow: hidden; border-radius: 10px; background: var(--mint); }
.result-meter span { display: block; height: 100%; border-radius: inherit; background: var(--commons-bright); transition: width .8s .2s ease; }
.result-detail { margin: 8px 0 25px; color: var(--muted); font-size: .76rem; }
.share-card { margin: 0 0 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--cream); text-align: left; }
.share-card-label { display: block; padding: 9px 13px; border-bottom: 1px solid var(--line); color: var(--commons); font-size: .65rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.share-card pre { max-height: 210px; margin: 0; overflow: auto; padding: 13px; color: var(--ink); font: 500 .75rem/1.55 "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; white-space: pre-wrap; word-break: break-word; }
.share-card pre:focus { outline: 2px solid var(--commons-bright); outline-offset: -2px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.copy-feedback { min-height: 18px; margin: 12px 0 -18px; color: var(--commons-bright); font-size: .75rem; }
.ten-minute-invitation { margin-top: 22px; padding: 18px; border-radius: 14px; background: var(--mint); }
.ten-minute-invitation p { margin: 0 0 12px; font-weight: 600; }
.results-newsletter { margin-top: 30px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; max-width: calc(100% - 32px); transform: translate(-50%, 20px); border-radius: 50px; padding: 11px 18px; background: var(--ink); color: white; font-size: .78rem; opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes float-a { 0%,100% { transform: translate3d(0,0,0) rotate(0deg); } 50% { transform: translate3d(var(--float-x),var(--float-y),0) rotate(var(--float-rotate)); } }
@keyframes correct-pop { 0% { opacity: 0; transform: translateY(-50%) scale(.5); } 30%,70% { opacity: 1; transform: translateY(-50%) scale(1); } 100% { opacity: 0; transform: translateY(-50%) scale(.7); } }
@keyframes correct-border { 30% { border-color: var(--commons-bright); box-shadow: 0 0 0 6px rgba(176,64,72,.13); } }
@keyframes item-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes timer-pulse { 50% { box-shadow: 0 0 0 5px rgba(183,68,53,.12); } }

@media (max-width: 880px) {
    .game-topline { align-items: flex-end; }
    .play-grid,
    .play-grid.is-playing { grid-template-columns: 1fr; }
    .memory-cloud { grid-row: 1; min-height: 390px; border-left: 0; border-bottom: 1px solid var(--line); }
    .recall-column { grid-row: 2; }
    .start-card { padding-top: 0; }
    .portrait-stage { inset: 55px 18px 30px; }
}

@media (max-width: 600px) {
    .page-shell { padding: 0 12px; }
    .site-header { min-height: 66px; padding: 0 7px; }
    main { padding-top: 14px; }
    .game-panel { min-height: calc(100vh - 98px); border-radius: 20px; }
    .game-topline { display: block; padding: 24px 20px 20px; }
    h1 { font-size: clamp(1.25rem, min(7.5vw, 30px), 2rem); line-height: 1.3; letter-spacing: 0; white-space: nowrap; overflow-wrap: normal; }
    .stats-block { margin-top: 22px; }
    .stat { min-width: 0; flex: 1; padding: 10px 13px; }
    .memory-cloud { min-height: 300px; }
    .recall-column { padding: 26px 20px 32px; }
    .portrait-bubble { width: min(var(--bubble-size), 116px); height: min(var(--bubble-size), 116px); }
    .portrait-credit { right: 12px; bottom: 9px; }
    .result-actions { grid-template-columns: 1fr; }
    footer { padding-inline: 10px; }
    .home-photo img { border-radius: 14px; }
    .home-photo figcaption { font-size: .62rem; }
    .modal { border-radius: 18px; }
    .rules-list li { line-height: 1.8; }
    .input-wrap input { min-height: 58px; font-size: 1rem; }
    .named-list { max-height: 200px; }
    .lead-copy { line-height: 1.8; font-size: .92rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
