/* Wordle-specific layouts; colors, controls and dialogs come from Pathly's shared UI. */
[hidden], .screen[hidden] { display: none !important; }
.screen:not(.active) { visibility: hidden; }
#main-menu { overflow-y: auto; padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.difficulty-start { height: 56px; text-align: left; }
.difficulty-start .daily-complete-icon { color: var(--success); width: 18px; height: 18px; }
.wordle-header { width: 100%; align-self: stretch; gap: 12px; margin-bottom: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.game-heading { flex: 1; }
.game-heading { text-align: center; min-width: 0; }
.game-heading .title-text { font-size: 20px; letter-spacing: -.5px; }
.game-heading p { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
#game-screen { align-items: center; padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); gap: 6px; overflow-y: auto; }
.wordle-play-area { flex: 1; min-height: 240px; display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; gap: 8px; }
#wordle-board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; padding: 12px; border-radius: 24px; background: var(--board); width: min(100%, calc(var(--word-length) * 56px + 24px)); }
.wordle-row { display: grid; grid-template-columns: repeat(var(--word-length), minmax(0, 1fr)); gap: 6px; }
.wordle-cell { width: 100%; aspect-ratio: 1; max-height: 56px; display: grid; place-items: center; border-radius: 9px; background: var(--tile); border: 1px solid var(--line); font-size: clamp(12px, 4.4vw, 25px); font-weight: 750; text-transform: uppercase; }
.wordle-cell.filled { border-color: var(--primary-light); }
.wordle-cell.correct, .example-tiles .correct, .keyboard-key.correct { background: #059669; border-color: #059669; color: #fff; }
.wordle-cell.present, .example-tiles .present, .keyboard-key.present { background: #b7790b; border-color: #b7790b; color: #fff; }
.wordle-cell.absent, .example-tiles .absent, .keyboard-key.absent { background: #647184; border-color: #647184; color: #fff; }
.wordle-notice { position: fixed; top: 24%; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); z-index: 40; padding: 12px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text-color); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); font-size: 13px; line-height: 1.5; text-align: center; pointer-events: none; }
.wordle-notice.error { border-color: var(--danger); }
#view-result { padding: 8px 18px; font-size: 12px; }
#stage-next { width: min(100%, 220px); min-height: 44px; padding: 12px 20px; font-size: 14px; background: var(--primary); border-color: var(--primary); color: #fff; }
#wordle-keyboard { width: min(100%, 540px); display: flex; flex-direction: column; gap: 7px; flex-shrink: 0; }
.keyboard-layer { width: min(100%, 540px); display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.keyboard-row { display: flex; justify-content: center; gap: 5px; }
.keyboard-key { flex: 1; min-width: 0; height: 49px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-color); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; }
.keyboard-key.wide { flex: 1.5; font-size: 11px; }
.keyboard-key[data-key="Enter"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.keyboard-key[data-key="Backspace"] { background: #b4233b; border-color: #b4233b; color: #fff; }
[data-theme="dark"] .keyboard-key:not(.correct):not(.present):not(.absent):not(.wide) { background: #354156; border-color: #46536a; color: #f8fafc; }
[data-theme="dark"] .keyboard-key.absent { background: #10151e; border-color: #252d3c; color: #8b98ac; }
.keyboard-row:nth-child(2) { padding: 0 4.5%; }
@media (hover: hover) { .keyboard-key:hover { filter: brightness(.94); } }
.keyboard-key:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.keyboard-key:disabled { cursor: default; }
.word-length-setting { position: relative; width: max-content; max-width: 100%; margin-top: 8px; text-align: left; }
.word-length-trigger { min-height: 44px; padding: 10px 14px; gap: 10px; border-radius: 12px; text-align: left; }
.word-length-value { border-radius: 9px; background: transparent; color: var(--primary); font-size: 14px; font-weight: 650; padding: 0; white-space: nowrap; }
[data-theme="dark"] .word-length-value { background: transparent; color: var(--primary-light); }
.word-length-trigger .icon { width: 16px; height: 16px; color: var(--text-muted); transition: transform .15s; }
.word-length-trigger[aria-expanded="true"] { border-color: var(--primary); background: var(--surface); }
.word-length-trigger[aria-expanded="true"] .icon { transform: rotate(180deg); }
.word-length-options { position: absolute; left: 50%; width: min(300px, calc(100vw - 36px)); transform: translateX(-50%); bottom: calc(100% + 10px); z-index: 25; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .15); }
.word-length-options.open-below { bottom: auto; top: calc(100% + 10px); }
.word-length-option { display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 3px; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-color); color: var(--text-color); font: inherit; cursor: pointer; }
.word-length-option strong { font-size: 20px; line-height: 1.2; }
.word-length-option span { font-size: 10px; color: var(--text-muted); }
.word-length-option:hover { border-color: var(--primary-light); background: var(--board); }
.word-length-option[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.word-length-option[aria-selected="true"] span { color: #fff; }
.word-length-option:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }
input, select { user-select: auto; -webkit-user-select: auto; }
.wordle-dialog { width: min(400px, calc(100% - 28px)); }
.wordle-dialog .dialog-intro { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin-bottom: 20px; }
.dialog-note { font-size: 12px; line-height: 1.6; color: var(--text-muted); margin: 20px 0 0; }
.example { margin-top: 18px; }
.example-tiles { display: flex; gap: 5px; }
.example-tiles span { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; font-weight: 700; }
.example p { font-size: 12px; margin-top: 7px; color: var(--text-muted); }
.full-button { width: 100%; min-height: 44px; margin-top: 20px; }
.mode-tabs { display: flex; gap: 8px; }
.mode-tabs button { flex: 1; padding: 10px; }
.mode-tabs .active { border-color: var(--primary); color: var(--primary); }
.stats-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; text-align: center; }
.stats-summary strong { display: block; font-size: 25px; letter-spacing: -1px; }
.stats-summary span { font-size: 10px; color: var(--text-muted); }
.small-heading { font-size: 12px; font-weight: 600; margin: 10px 0; }
.distribution-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 6px 0; }
.distribution-label { width: 12px; }
.distribution-track { flex: 1; background: var(--board); border-radius: 5px; overflow: hidden; }
.distribution-bar { min-width: 24px; padding: 5px 8px; background: var(--primary); color: #fff; text-align: right; }
.result-grid { display: grid; gap: 4px; margin: 0 auto 18px; width: max-content; }
.result-grid > div { display: flex; gap: 4px; }
.result-grid span { height: 17px; width: 17px; border-radius: 4px; background: #647184; }
.result-grid span.correct { background: #059669; }
.result-grid span.present { background: #b7790b; }
.result-description { color: var(--text-muted); text-align: center; font-size: 14px; line-height: 1.6; }
#result-points { display: block; text-align: center; font-size: 32px; color: var(--primary); margin-top: 14px; letter-spacing: -1px; }
.wordle-dialog .neu-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.result-actions { display: flex; gap: 8px; margin-top: 24px; }
.result-actions button { flex: 1; padding: 12px 8px; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
dialog button { font: inherit; }
@media (max-width: 519px) { #game-screen { padding-left: 12px; padding-right: 12px; } .wordle-header { gap: 6px; } .wordle-header .neu-btn-circle { width: 40px; height: 40px; } .wordle-header .icon { width: 20px; height: 20px; } .header-actions { gap: 6px; } .game-heading .title-text { font-size: 17px; } .game-heading p { font-size: 10px; } .keyboard-key { height: 48px; font-size: 13px; } #wordle-board { padding: 10px; gap: 5px; } .wordle-row { gap: 4px; } }
@media (max-height: 700px) { .wordle-play-area { min-height: 210px; } #wordle-board { width: min(100%, calc(var(--word-length) * 43px + 24px)); } .wordle-cell { max-height: 43px; font-size: 20px; } .keyboard-key { height: 42px; } }
@media (max-width: 759px) and (pointer: coarse) {
    #game-screen { padding-inline: 12px; padding-bottom: 0; overflow-x: hidden; }
    .keyboard-layer { position: sticky; bottom: 0; z-index: 15; width: calc(100% + 24px); padding: 14px 12px max(8px, env(safe-area-inset-bottom)); background: var(--board); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; }
    .keyboard-key { height: 48px; border-radius: 8px; }
}
@media (max-width: 759px) and (pointer: coarse) and (max-height: 650px) {
    #wordle-board { width: min(100%, calc(var(--word-length) * 33px + 24px)); }
    .keyboard-key { height: 42px; }
}
@media (min-width: 760px) and (max-height: 550px) { #game-screen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; } .wordle-header { grid-column: 1 / -1; width: 100%; } .wordle-play-area { grid-column: 1; grid-row: 2 / 4; } .hint-action-row { grid-column: 2; grid-row: 2; align-self: end; } .keyboard-layer { grid-column: 2; grid-row: 3; align-self: start; } }

.hint-action-row { width: min(100%, 540px); display: flex; justify-content: center; flex-shrink: 0; padding: 0 0 4px; }
.hint-button { position: relative; }
.hint-button .hint-count { right: -4px; top: -4px; width: 17px; height: 17px; font-size: 10px; }
@media (max-width: 519px) { .hint-button { width: 40px; height: 40px; } .hint-button .icon { width: 20px; height: 20px; } }

/* Home and gameplay share the same full-page frame and header alignment. */
:root { --wordly-page-inset: 24px; }
@media (min-width: 760px) { :root { --wordly-page-inset: 48px; } }
@media (max-width: 519px) { :root { --wordly-page-inset: 18px; } }
#main-menu, #game-screen {
    padding-inline: var(--wordly-page-inset);
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
}
#game-screen .wordle-header .neu-btn-circle { width: 48px; height: 48px; }
#game-screen .wordle-header .icon { width: 23px; height: 23px; }
#main-menu > .header-bar, #game-screen > .header-bar { align-self: start; height: 48px; }
@media (max-width: 519px) {
    #main-menu > .header-bar, #game-screen > .header-bar { height: 44px; }
    #game-screen .wordle-header .neu-btn-circle, .hint-button { width: 44px; height: 44px; }
    .hint-button .icon { width: 23px; height: 23px; }
}
@media (max-width: 759px) and (pointer: coarse) {
    #game-screen { padding-bottom: 0; }
    .keyboard-layer { width: calc(100% + 2 * var(--wordly-page-inset)); }
}
@media (max-width: 759px) and (pointer: coarse) and (max-height: 650px) {
    #wordle-board { width: min(100%, calc(var(--word-length) * 32px + 24px)); }
}

.settings-dialog:focus { outline: none; }

.home-game-options { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.home-game-options .word-length-setting { margin-top: 0; }
.word-language-setting { position: relative; }
.word-language-setting select { appearance: none; min-height: 44px; padding: 10px 38px 10px 14px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 650; color: var(--primary); cursor: pointer; }
[data-theme="dark"] .word-language-setting select { color: var(--primary-light); }
.word-language-setting > .icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; pointer-events: none; color: var(--text-muted); }
