/* =========================================
   OBU Vocabulary Quest
   RPG Theme Version 1.2
========================================= */

:root {
    --night-950: #050814;
    --night-900: #091226;
    --night-800: #111d38;
    --night-700: #1a2b4d;
    --gold-500: #d6a94b;
    --gold-400: #f0cb72;
    --gold-300: #ffe8a6;
    --parchment-100: #fffaf0;
    --parchment-200: #f7ecd2;
    --parchment-300: #ead8ad;
    --ink: #2e2418;
    --emerald: #15966d;
    --emerald-dark: #0d634b;
    --ruby: #bd3b47;
    --ruby-dark: #79232c;
    --blue: #2e6cb0;
    --shadow: rgba(2, 6, 23, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--night-950);
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    padding: 28px 0 42px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% -10%, rgba(69, 111, 181, 0.35), transparent 34%),
        radial-gradient(circle at 8% 34%, rgba(29, 93, 83, 0.22), transparent 30%),
        radial-gradient(circle at 92% 75%, rgba(112, 48, 89, 0.2), transparent 30%),
        linear-gradient(155deg, #071020 0%, #0a1428 46%, #050813 100%);
    color: var(--parchment-100);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        Meiryo,
        sans-serif;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255, 232, 166, 0.55) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(183, 216, 255, 0.32) 0 1px, transparent 1.5px);
    background-position: 0 0, 35px 50px;
    background-size: 88px 88px, 122px 122px;
    content: "";
    opacity: 0.45;
    animation: starDrift 28s linear infinite;
}

body::after {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,0.015) 50%, transparent 50.5%),
        linear-gradient(0deg, transparent 49.5%, rgba(255,255,255,0.012) 50%, transparent 50.5%);
    background-size: 70px 70px;
    content: "";
    mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.ambientLight {
    position: fixed;
    z-index: -1;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(70px);
    opacity: 0.2;
}

.ambientLightOne {
    top: 8%;
    left: -150px;
    background: #2e7fa4;
}

.ambientLightTwo {
    right: -180px;
    bottom: 4%;
    background: #9c5d2d;
}

@keyframes starDrift {
    from { transform: translateY(0); }
    to { transform: translateY(88px); }
}

[hidden] {
    display: none !important;
}

.container {
    width: min(94%, 620px);
    margin: 0 auto;
}

.container:not([hidden]) {
    animation: screenEnter 0.48s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes screenEnter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ------------------------------
   タイトル
------------------------------ */

.heroHeader {
    margin: 2px 0 22px;
    text-align: center;
}

.eyebrow,
.panelKicker,
.resultKicker {
    margin: 0;
    color: var(--gold-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

h1,
h2 {
    font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
}

h1 {
    margin: 8px 0 5px;
    color: var(--gold-300);
    font-size: clamp(30px, 7.5vw, 46px);
    line-height: 1.12;
    letter-spacing: 0.01em;
    text-shadow:
        0 2px 0 #6d4e1e,
        0 0 22px rgba(240, 203, 114, 0.25),
        0 10px 35px rgba(0, 0, 0, 0.4);
}

.titleIcon {
    display: inline-block;
    margin-right: 3px;
    filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.5));
    animation: bookFloat 3.2s ease-in-out infinite;
}

@keyframes bookFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

.subtitle {
    margin: 0;
    color: #c5d0e3;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    font-style: italic;
    letter-spacing: 0.06em;
}

/* ------------------------------
   羊皮紙カード
------------------------------ */

.card {
    position: relative;
    padding: 26px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 250, 240, 0.96), rgba(247, 236, 210, 0.97)),
        repeating-linear-gradient(0deg, rgba(99, 72, 31, 0.02) 0 1px, transparent 1px 5px);
    border: 1px solid #d9bb7a;
    border-radius: 20px;
    box-shadow:
        0 0 0 4px rgba(47, 31, 14, 0.28),
        0 0 0 6px rgba(214, 169, 75, 0.55),
        0 22px 55px var(--shadow),
        inset 0 0 40px rgba(130, 91, 31, 0.08);
    color: var(--ink);
}

.card::before,
.card::after {
    position: absolute;
    width: 76px;
    height: 76px;
    border: 2px solid rgba(147, 103, 38, 0.34);
    content: "";
    pointer-events: none;
}

.card::before {
    top: 10px;
    left: 10px;
    border-right: 0;
    border-bottom: 0;
    border-radius: 13px 0 0 0;
}

.card::after {
    right: 10px;
    bottom: 10px;
    border-top: 0;
    border-left: 0;
    border-radius: 0 0 13px 0;
}

.panelHeading,
.historyHeading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 13px;
}

.panelHeading {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(131, 92, 34, 0.25);
}

.panelEmblem {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(145deg, #293b5d, #111b31);
    border: 2px solid var(--gold-500);
    border-radius: 50%;
    color: var(--gold-300);
    font-size: 24px;
    box-shadow: 0 6px 16px rgba(9, 18, 38, 0.3);
}

.panelHeading h2,
.historyTitle {
    margin: 3px 0 0;
    color: #3b2a17;
}

.panelHeading h2 {
    font-size: 25px;
}

.panelKicker {
    color: #8b672d;
    font-size: 9px;
}

/* ------------------------------
   設定フォーム
------------------------------ */

.settingsGrid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 17px 14px;
}

.fieldGroup {
    min-width: 0;
}

.fieldWide {
    grid-column: 1 / -1;
}

label,
.inputLabel {
    display: block;
    margin: 0 0 7px;
    color: #4d3922;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

input[type="number"],
select,
#answerInput {
    display: block;
    width: 100%;
    height: 49px;
    padding: 0 13px;
    background: rgba(255, 253, 247, 0.86);
    border: 1px solid #b9975b;
    border-radius: 8px;
    color: #2c2419;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    box-shadow:
        inset 0 1px 4px rgba(78, 54, 18, 0.09),
        0 1px 0 rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

input[type="number"]:focus,
select:focus,
#answerInput:focus {
    border-color: #8f661e;
    box-shadow: 0 0 0 3px rgba(214, 169, 75, 0.28);
    transform: translateY(-1px);
}

.checkboxRow {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 19px;
    padding: 12px 14px;
    background: rgba(245, 226, 184, 0.56);
    border: 1px solid rgba(157, 115, 46, 0.33);
    border-radius: 9px;
}

.checkboxRow input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #8d6623;
}

.checkboxRow label {
    margin: 0;
    cursor: pointer;
}

/* ------------------------------
   ボタン
------------------------------ */

button {
    position: relative;
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    overflow: hidden;
    background: linear-gradient(180deg, #386eaf, #234f88);
    border: 1px solid #183d6e;
    border-radius: 9px;
    color: #fffdf3;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 5px 0 #163a67,
        0 9px 18px rgba(12, 28, 51, 0.23);
    cursor: pointer;
    transition: transform 0.16s, filter 0.16s, box-shadow 0.16s;
}

button::after {
    position: absolute;
    top: -100%;
    left: -45%;
    width: 38%;
    height: 300%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.23), transparent);
    content: "";
    transform: rotate(24deg);
    transition: left 0.45s;
}

button:not(:disabled):hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

button:not(:disabled):hover::after {
    left: 115%;
}

button:not(:disabled):active {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 2px 0 #163a67,
        0 5px 10px rgba(12, 28, 51, 0.2);
    transform: translateY(3px);
}

button:disabled {
    cursor: default;
    filter: saturate(0.75);
}

.startQuestButton {
    z-index: 1;
    min-height: 58px;
    margin-top: 23px;
    background: linear-gradient(180deg, #d3a849, #9a6e21);
    border-color: #785019;
    color: #fff8d6;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    letter-spacing: 0.08em;
    box-shadow:
        inset 0 1px 0 rgba(255, 251, 212, 0.45),
        0 5px 0 #6f4816,
        0 11px 24px rgba(80, 48, 7, 0.3);
}

.smallButton {
    width: auto;
    min-height: 41px;
    padding: 8px 13px;
    background: linear-gradient(180deg, #394a68, #202d46);
    border-color: #111c30;
    font-size: 13px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 3px 0 #10192a,
        0 7px 14px rgba(0, 0, 0, 0.25);
}

.reviewButton {
    margin-top: 15px;
    background: linear-gradient(180deg, #b9503e, #873126);
    border-color: #68231b;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 5px 0 #641f19,
        0 9px 18px rgba(78, 25, 20, 0.24);
}

.secondaryButton {
    margin-top: 14px;
    background: linear-gradient(180deg, #fffaf0, #e9d6ad);
    border-color: #9e7939;
    color: #563b17;
    text-shadow: none;
    box-shadow:
        inset 0 1px 0 #fff,
        0 4px 0 #a27a37,
        0 8px 14px rgba(61, 42, 14, 0.16);
}

.historyResetButton {
    min-height: 40px;
    margin-top: 10px;
    background: transparent;
    border: 1px solid rgba(98, 70, 28, 0.45);
    color: #765728;
    font-size: 13px;
    text-shadow: none;
    box-shadow: none;
}

.historyResetButton:hover {
    background: rgba(124, 88, 31, 0.08);
}

/* ------------------------------
   冒険の記録
------------------------------ */

.historyPanel {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    padding: 17px;
    background:
        linear-gradient(145deg, rgba(31, 47, 76, 0.97), rgba(13, 25, 48, 0.98));
    border: 1px solid #756039;
    border-radius: 12px;
    color: #f8edd5;
    box-shadow:
        inset 0 0 0 1px rgba(240, 203, 114, 0.09),
        0 10px 22px rgba(12, 20, 36, 0.24);
}

.historyHeading {
    justify-content: space-between;
    margin-bottom: 13px;
}

.historyTitle {
    color: var(--gold-300);
    font-size: 19px;
}

.historyHeading .panelKicker {
    color: #9fb1ce;
}

.logIcon {
    font-size: 26px;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.35));
}

.historyGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.historyItem {
    padding: 12px 6px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(240, 203, 114, 0.19);
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}

.historyItem:hover {
    background: rgba(255, 255, 255, 0.085);
    transform: translateY(-2px);
}

.historyItem span {
    display: block;
    color: #aab8cd;
    font-size: 11px;
    font-weight: 700;
}

.historyItem strong {
    display: block;
    margin-top: 4px;
    color: var(--gold-300);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 23px;
}

.footerNote {
    margin: 24px 0 0;
    color: rgba(194, 207, 226, 0.48);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-align: center;
}

/* ------------------------------
   問題画面ヘッダー・進行ゲージ
------------------------------ */

.quizHeader {
    display: grid;
    grid-template-columns: 94px 1fr 94px;
    align-items: center;
    gap: 8px;
    margin: 3px 0 15px;
}

.questStatus {
    min-width: 0;
    text-align: center;
}

.questStatus span {
    color: var(--gold-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.2em;
}

.questStatus h2 {
    margin: 3px 0 0;
    color: var(--gold-300);
    font-size: clamp(20px, 5.5vw, 28px);
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

.headerCrest {
    justify-self: end;
    font-size: 30px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.45));
}

.progressPanel {
    margin-bottom: 16px;
    padding: 11px 13px;
    background: rgba(5, 11, 25, 0.7);
    border: 1px solid rgba(240, 203, 114, 0.3);
    border-radius: 10px;
    box-shadow: inset 0 0 16px rgba(0,0,0,0.3);
}

.progressMeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
    color: #aebbd0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.progressMeta strong {
    color: var(--gold-300);
    font-size: 11px;
}

.progressTrack {
    height: 10px;
    padding: 2px;
    overflow: hidden;
    background: #020612;
    border: 1px solid #5e4c2d;
    border-radius: 999px;
}

.progressBar {
    width: 0;
    height: 100%;
    background:
        linear-gradient(90deg, #1f8f66, #5ad39d 68%, #e7d66c);
    border-radius: inherit;
    box-shadow: 0 0 12px rgba(73, 209, 151, 0.55);
    transition: width 0.45s cubic-bezier(.2,.8,.2,1);
}

/* ------------------------------
   バトル画面
------------------------------ */

.battleCard {
    padding-top: 23px;
}

.encounterBadge {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 14px;
    color: #896324;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

#questionSentence {
    position: relative;
    z-index: 1;
    margin: 0 0 14px;
    padding: 26px 18px;
    background:
        radial-gradient(circle at 50% 0%, rgba(255,255,255,0.9), transparent 55%),
        linear-gradient(145deg, #fffdf8, #f1e2bf);
    border: 1px solid #c19a53;
    border-radius: 11px;
    color: #1f2734;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(22px, 5.7vw, 30px);
    font-weight: 700;
    line-height: 1.65;
    text-align: center;
    overflow-wrap: anywhere;
    box-shadow:
        inset 0 0 20px rgba(112, 77, 24, 0.07),
        0 8px 18px rgba(79, 54, 17, 0.12);
    animation: questionReveal 0.42s ease both;
}

#questionTranslation {
    position: relative;
    z-index: 1;
    margin: 0 0 20px;
    padding: 12px 15px;
    background: rgba(82, 60, 26, 0.07);
    border: 1px dashed rgba(131, 91, 31, 0.44);
    border-radius: 8px;
    color: #57452f;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.7;
    text-align: center;
    animation: translationReveal 0.46s 0.06s ease both;
}

@keyframes questionReveal {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes translationReveal {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.commandArea {
    position: relative;
    z-index: 1;
}

.choiceButton {
    min-height: 55px;
    margin-top: 10px;
    padding-left: 17px;
    background: linear-gradient(180deg, #263a5c, #172844);
    border: 1px solid #8a7447;
    border-left: 5px solid var(--gold-500);
    border-radius: 8px;
    color: #fff9e9;
    font-size: 16px;
    text-align: left;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 4px 0 #0b172c,
        0 8px 16px rgba(7, 16, 31, 0.25);
    animation: commandEnter 0.34s ease both;
}

.choiceButton:first-child {
    margin-top: 0;
}

.choiceButton:nth-child(2) { animation-delay: 0.05s; }
.choiceButton:nth-child(3) { animation-delay: 0.1s; }
.choiceButton:nth-child(4) { animation-delay: 0.15s; }

@keyframes commandEnter {
    from { opacity: 0; transform: translateX(-13px); }
    to { opacity: 1; transform: translateX(0); }
}

.choiceButton:not(:disabled):hover {
    border-color: var(--gold-400);
    border-left-color: var(--gold-300);
    filter: brightness(1.14);
    transform: translateX(5px);
}

.choiceButton:disabled {
    cursor: default;
    opacity: 0.82;
}

.choiceButton.correct {
    background: linear-gradient(180deg, #20845f, #10573f);
    border-color: #74dfb2;
    border-left-color: #b8ffe0;
    color: #f1fff9;
    opacity: 1;
    animation: criticalHit 0.52s ease both;
}

.choiceButton.incorrect {
    background: linear-gradient(180deg, #a13b47, #71242d);
    border-color: #e58b94;
    border-left-color: #ffc4ca;
    color: #fff3f4;
    opacity: 1;
    animation: missShake 0.42s ease both;
}

@keyframes criticalHit {
    0% { transform: scale(1); box-shadow: 0 4px 0 #0b172c; }
    45% { transform: scale(1.035); box-shadow: 0 0 26px rgba(75, 222, 159, 0.62); }
    100% { transform: scale(1); }
}

@keyframes missShake {
    0%, 100% { transform: translateX(0); }
    22% { transform: translateX(-7px); }
    45% { transform: translateX(7px); }
    68% { transform: translateX(-4px); }
    84% { transform: translateX(3px); }
}

#inputArea {
    position: relative;
    z-index: 1;
    margin-top: 5px;
}

#answerInput {
    height: 56px;
    font-size: 20px;
}

#answerInput.inputCorrect {
    background: #e3fff3;
    border-color: var(--emerald);
    color: #0e5d45;
    box-shadow: 0 0 0 3px rgba(21, 150, 109, 0.17);
}

#answerInput.inputIncorrect {
    background: #fff0f1;
    border-color: var(--ruby);
    color: #7c2530;
    box-shadow: 0 0 0 3px rgba(189, 59, 71, 0.16);
}

.attackButton {
    margin-top: 12px;
}

/* ------------------------------
   正誤・解説
------------------------------ */

#feedbackArea {
    position: relative;
    z-index: 1;
    margin-top: 20px;
}

#feedbackArea:not([hidden]) {
    animation: reportEnter 0.4s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes reportEnter {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

#judgementText {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.02em;
}

#judgementText.correctMessage {
    background: linear-gradient(145deg, #dffff0, #b9efd8);
    border-color: #50ad85;
    color: #0c6147;
    box-shadow: 0 0 22px rgba(36, 176, 120, 0.18);
}

#judgementText.incorrectMessage {
    background: linear-gradient(145deg, #fff1f1, #f6cdd1);
    border-color: #c8616c;
    color: #812630;
    box-shadow: 0 0 22px rgba(189, 59, 71, 0.16);
}

.answerDetails {
    padding: 18px;
    background: rgba(255, 252, 244, 0.67);
    border: 1px solid rgba(142, 99, 32, 0.38);
    border-radius: 10px;
    box-shadow: inset 0 0 18px rgba(94, 65, 21, 0.05);
}

.lootHeading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(123, 86, 30, 0.2);
    color: #7b5925;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11px;
    letter-spacing: 0.14em;
}

.detailLabel {
    margin: 15px 0 4px;
    color: #8c6b3b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.answerText {
    margin: 0;
    color: #33230f;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    font-weight: 900;
}

.fullSentence {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.65;
}

.nextBattleButton {
    margin-top: 20px;
    background: linear-gradient(180deg, #2c7f66, #1b5e4b);
    border-color: #124938;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 5px 0 #0e4435,
        0 9px 18px rgba(14, 68, 53, 0.24);
}

.nextBattleButton:not([hidden]) {
    animation: nextButtonEnter 0.35s 0.1s ease both;
}

@keyframes nextButtonEnter {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

#quizScreen.battleCorrect .battleCard {
    animation: victoryGlow 0.55s ease;
}

#quizScreen.battleIncorrect .battleCard {
    animation: damagePulse 0.42s ease;
}

@keyframes victoryGlow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(47,31,14,.28), 0 0 0 6px rgba(214,169,75,.55), 0 22px 55px var(--shadow); }
    48% { box-shadow: 0 0 0 4px rgba(21,150,109,.38), 0 0 0 8px rgba(84,224,167,.55), 0 22px 70px rgba(45,211,145,.35); }
}

@keyframes damagePulse {
    0%, 100% { transform: translateX(0); filter: none; }
    25% { transform: translateX(-4px); filter: sepia(.15) saturate(1.4); }
    55% { transform: translateX(4px); filter: sepia(.15) saturate(1.4); }
    78% { transform: translateX(-2px); }
}

/* ------------------------------
   結果画面
------------------------------ */

#resultScreen {
    padding-top: 20px;
    text-align: center;
}

.resultCrest {
    font-size: 66px;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
    animation: trophyEnter 0.62s cubic-bezier(.2,.9,.2,1.2) both;
}

@keyframes trophyEnter {
    from { opacity: 0; transform: translateY(-15px) scale(0.55) rotate(-10deg); }
    to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

.resultKicker {
    margin-top: 8px;
}

#resultScreen h2 {
    margin: 6px 0 17px;
    color: var(--gold-300);
    font-size: clamp(29px, 8vw, 42px);
    text-shadow:
        0 2px 0 #68491d,
        0 0 25px rgba(240, 203, 114, 0.22);
}

#resultText {
    margin: 0 0 16px;
    padding: 23px;
    background:
        linear-gradient(rgba(255,250,240,.97), rgba(244,230,199,.98));
    border: 1px solid #d2ad64;
    border-radius: 15px;
    color: #3d2b16;
    font-size: 18px;
    font-weight: 750;
    line-height: 1.8;
    box-shadow:
        0 0 0 4px rgba(58, 38, 13, 0.32),
        0 0 0 6px rgba(214, 169, 75, 0.47),
        0 18px 42px rgba(0,0,0,0.35);
}

.resultRank {
    display: inline-block;
    margin-bottom: 8px;
    color: #855f1f;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.resultExp {
    color: #236c56;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 900;
}

#resultScreen button {
    margin-top: 12px;
}

/* ------------------------------
   スマートフォン
------------------------------ */

@media (max-width: 520px) {
    body {
        padding: 18px 0 32px;
    }

    .container {
        width: 94%;
    }

    h1 {
        font-size: 31px;
    }

    .eyebrow {
        letter-spacing: 0.16em;
    }

    .card {
        padding: 20px 16px;
        border-radius: 15px;
    }

    .settingsGrid {
        gap: 15px 10px;
    }

    .quizHeader {
        grid-template-columns: 80px 1fr 40px;
    }

    .smallButton {
        padding: 8px 9px;
        font-size: 12px;
    }

    .headerCrest {
        font-size: 25px;
    }

    #questionSentence {
        padding: 22px 12px;
        font-size: 22px;
    }

    #questionTranslation {
        font-size: 14px;
    }

    .choiceButton {
        min-height: 54px;
        padding: 13px 12px;
        font-size: 15px;
    }

    .choiceButton:not(:disabled):hover {
        transform: none;
    }

    .historyItem strong {
        font-size: 20px;
    }
}

@media (max-width: 390px) {
    .settingsGrid {
        grid-template-columns: 1fr;
    }

    .fieldWide {
        grid-column: auto;
    }

    .historyGrid {
        grid-template-columns: 1fr;
    }

    .historyItem {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 9px 13px;
    }

    .historyItem strong {
        margin-top: 0;
    }
}

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