/* Settings use a fixed footer and a separate scroll area on the 640 × 360 stage. */
.settings-screen { padding: 12px 34px; justify-content: center; background: #132d37e8; backdrop-filter: blur(3px); }
.settings-panel { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; overflow: hidden; border: 2px solid #173e4b; border-radius: 13px; background: #eaf0dc; color: #244c58; box-shadow: inset 0 2px #ffffffe0, 0 5px #092d3780; font-family: Arial, "Malgun Gothic", sans-serif; }
.settings-header { display: flex; flex: none; align-items: center; justify-content: space-between; min-height: 46px; gap: 12px; padding: 7px 13px; background: #244c58; color: #fff9dc; border-bottom: 2px solid #173e4b; }
.settings-header h2 { margin: 0; font-size: 18px; line-height: 21px; }
.settings-eyebrow { display: block; font-size: 7px; font-weight: 800; letter-spacing: 1.5px; color: #a9c9c6; }
.settings-header p { margin: 0; font-size: 9px; color: #d1e4da; text-align: right; }
.settings-scroll { min-height: 0; flex: 1; overflow: auto; padding: 9px 10px; scrollbar-width: thin; scrollbar-color: #749c9c #d7e5d6; overscroll-behavior: contain; touch-action: pan-y; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.settings-group { min-width: 0; padding: 8px; border: 1px solid #abc1af; border-radius: 8px; background: #fffdf0; }
.settings-group h3 { margin: 0 0 6px; font-size: 11px; font-weight: 800; color: #345d63; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 29px; padding: 3px 0; }
.settings-row > div, .settings-row > label { min-width: 0; }
.settings-row span { display: block; font-size: 10px; font-weight: 700; line-height: 1.25; }
.settings-row small { display: block; margin-top: 2px; color: #71877a; font-size: 8px; line-height: 1.3; }
.settings-panel .btn { min-height: 25px; height: auto; width: auto; border: 1px solid #557c79; border-radius: 6px; padding: 4px 8px; background: #d7e8df; color: #315962; box-shadow: inset 0 1px #fff8, 0 2px #31596225; justify-content: center; white-space: normal; font-size: 10px; line-height: 1.25; }
.settings-panel .settings-switch { width: 43px; min-width: 43px; }
.settings-panel .settings-switch.on { background: #437c76; border-color: #315c58; color: white; }
.settings-panel select { max-width: 145px; min-height: 28px; border: 1px solid #7a9b90; border-radius: 6px; background: #e6f0e6; color: #284e57; padding: 4px; font: inherit; font-size: 9px; cursor: pointer; }
.settings-volume { display: grid; grid-template-columns: 47px minmax(0, 1fr) 29px; align-items: center; gap: 5px; margin: 4px 0 9px; padding: 5px 0; color: #617d73; font-size: 8px; }
.settings-volume input { width: 100%; height: 16px; margin: 0; accent-color: #387d77; cursor: pointer; }
.settings-volume input:disabled { opacity: .4; }
.settings-volume output { color: #315962; text-align: right; font-size: 9px; font-variant-numeric: tabular-nums; }
.settings-language, .settings-tools { grid-column: 1 / -1; }
.settings-language .settings-row { padding: 0; }
.settings-language select { width: 190px; max-width: 60%; font-family: Arial, "Malgun Gothic", sans-serif; }
.settings-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.settings-panel .settings-danger { color: #965a49; border-color: #bf9a84; background: #f2e1d2; }
.settings-footer { flex: none; display: flex; justify-content: flex-end; padding: 7px 10px; background: #d9e6d7; border-top: 1px solid #a4bcae; }
.settings-panel .settings-footer .btn { width: 144px; min-height: 29px; font-size: 12px; font-weight: 800; color: #6c4e20; background: #ffdc7d; border-color: #a48641; }
.settings-panel :focus-visible { outline: 2px solid #c48621; outline-offset: 2px; }

/* HTML choice controls use the game's typeface and scale with the stage. */
.settings-panel .game-select-trigger { position: relative; flex: none; max-width: 145px; min-height: 28px; padding: 5px 23px 5px 8px; border: 1px solid #557c79; border-radius: 6px; color: #284e57; background: linear-gradient(#f5f9e9, #d5e7da); box-shadow: inset 0 1px #fff, 0 2px #31596220; font-family: var(--game-font, inherit); text-align: left; cursor: pointer; }
.settings-panel .game-select-trigger span { font-size: 9px; line-height: 1.3; font-weight: inherit; }
.game-select-trigger::after { content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; border-right: 2px solid #46736d; border-bottom: 2px solid #46736d; transform: translateY(-70%) rotate(45deg); }
.game-select-trigger[aria-expanded="true"] { border-color: #a67b29; outline: 2px solid #e9bd6966; }
.game-select-trigger[aria-expanded="true"]::after { transform: translateY(-20%) rotate(225deg); }
.game-select-trigger:disabled { opacity: .55; cursor: wait; }
.settings-language .game-select-trigger { width: 190px; max-width: 60%; }
.game-select-layer { position: absolute; inset: 0; z-index: 90; pointer-events: auto; background: #102e3818; font-family: var(--game-font, inherit); }
.game-select-list { position: absolute; box-sizing: border-box; overflow: auto; padding: 4px; color: #284e57; background: #fff8df; border: 2px solid #345d63; border-radius: 8px; box-shadow: inset 0 1px #fff, 0 4px #102e3866, 0 7px 18px #102e3833; outline: none; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #6d9c91 #d8e5ce; }
.game-select-option { position: relative; min-height: 28px; box-sizing: border-box; display: flex; align-items: center; padding: 6px 25px 6px 9px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; line-height: 1.25; cursor: pointer; }
.game-select-option + .game-select-option { margin-top: 2px; }
.game-select-option.focused, .game-select-option:hover { background: #e2ecd7; border-color: #9ab7a1; }
.game-select-option[aria-selected="true"] { color: #fff9df; background: #407d74; border-color: #2f625c; box-shadow: inset 0 1px #ffffff30; }
.game-select-option[aria-selected="true"]::after { content: ""; position: absolute; right: 10px; width: 5px; height: 9px; border-right: 2px solid #ffe39a; border-bottom: 2px solid #ffe39a; transform: translateY(-2px) rotate(45deg); }
.game-select-option[aria-disabled="true"] { opacity: .5; cursor: default; }
.game-select-list::-webkit-scrollbar, .settings-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.game-select-list::-webkit-scrollbar-track, .settings-scroll::-webkit-scrollbar-track { background: #d8e5ce; border-radius: 8px; }
.game-select-list::-webkit-scrollbar-thumb, .settings-scroll::-webkit-scrollbar-thumb { background: #6d9c91; border-radius: 8px; }

#commerce-layer { position: absolute; inset: 0; z-index: 120; display: grid; place-items: center; background: #102e38d9; pointer-events: auto; color: #315963; font-family: var(--game-font, inherit); outline: none; }
.commerce-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 280px; padding: 25px 18px; border: 2px solid #365c64; border-radius: 12px; background: #fff5d9; box-shadow: inset 0 2px #fffef4, 0 5px #092c3966; text-align: center; }
.commerce-wait b { font-size: 13px; line-height: 1.5; }
.commerce-wait small { color: #7a8d78; font-size: 9px; }
.rewarded-audience { margin:auto; width:min(25rem,90vw); max-height:90dvh; overflow:auto; box-sizing:border-box; padding:1rem; border:2px solid #365c64; border-radius:12px; color:#254851; background:#fff5d9; font-family:var(--game-font,inherit); }
.rewarded-audience::backdrop { background:#102e38ba; }
.rewarded-audience h2 { margin:0 0 .85rem; text-align:center; font-size:1.05rem; }
.rewarded-audience form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
.rewarded-audience button { min-height:44px; white-space:normal; }
.rewarded-audience button:last-child { grid-column:1/-1; }
.commerce-spinner { width: 26px; height: 26px; border: 4px solid #cedccb; border-top-color: #4d8c81; border-right-color: #e6b955; border-radius: 50%; animation: commerce-spin 1s linear infinite; }
@keyframes commerce-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .commerce-spinner { animation: none; } }

/* Translated switch labels and volume names keep their full readable width. */
.settings-panel .settings-switch{width:auto;min-width:43px;max-width:90px;flex:0 0 auto;overflow-wrap:anywhere}
.settings-volume{grid-template-columns:68px minmax(0,1fr) 29px}
.settings-volume label{min-width:0;overflow-wrap:anywhere;line-height:1.35}
