.hc-shell {
    max-width: 620px;
    min-height: calc(100vh - 72px);
    margin: 0 auto;
    padding: 12px 12px 6px;
}

.hc-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.hc-logo { margin: 0; color: var(--text); font-size: 1.25rem; }
.hc-mode {
    min-height: 18px;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.hc-mode:empty { display: none; }
.hc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.icon-btn {
    min-width: 36px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 17px;
}
.icon-btn:hover { border-color: var(--primary); background: var(--bg-subtle); }

.temperature-stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 16px 0 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(239,68,68,.10), transparent 43%),
        linear-gradient(0deg, rgba(14,165,233,.12), transparent 43%),
        var(--bg-card);
}
.temperature-glow {
    position: absolute;
    z-index: -1;
    left: 10%;
    width: 80%;
    height: 34%;
    filter: blur(30px);
    opacity: .34;
    pointer-events: none;
}
.temperature-glow-hot {
    top: -14%;
    background: radial-gradient(ellipse, #fb923c, transparent 68%);
}
.temperature-glow-cold {
    bottom: -14%;
    background: radial-gradient(ellipse, #38bdf8, transparent 68%);
}
.guess-stack { display: grid; gap: 8px; }
.temperature-row {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    min-height: 62px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    transition: transform .3s ease, opacity .3s ease;
}
.temperature-row::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .9;
}
.temperature-row.hot::before {
    background:
        radial-gradient(circle at 15% 50%, rgba(254,215,170,.52), transparent 32%),
        linear-gradient(90deg, rgba(239,68,68,.25), rgba(249,115,22,.08));
}
.temperature-row.cold::before {
    background:
        radial-gradient(circle at 85% 50%, rgba(186,230,253,.56), transparent 32%),
        linear-gradient(90deg, rgba(14,165,233,.08), rgba(2,132,199,.25));
}
.temperature-row.hot.far, .temperature-row.cold.far { opacity: .38; }
.temperature-row.hot.near, .temperature-row.cold.near {
    opacity: .94;
    border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
    box-shadow: 0 5px 16px rgba(0,0,0,.08);
}
.temperature-row.hot.near.promoted {
    animation: promoteHotRow .9s cubic-bezier(.2,.85,.25,1);
}
.temperature-row.cold.near.promoted {
    animation: promoteColdRow .9s cubic-bezier(.2,.85,.25,1);
}
.temperature-row.near.promoted .word-tile {
    animation: promoteTileGlow .9s ease;
}
@keyframes promoteHotRow {
    0% { transform: translateY(30px) scale(.96); opacity: .25; }
    52% {
        transform: translateY(-4px) scale(1.018);
        opacity: 1;
        border-color: #f97316;
        box-shadow: 0 0 0 3px rgba(249,115,22,.2), 0 9px 24px rgba(239,68,68,.22);
    }
    100% { transform: none; opacity: .94; }
}
@keyframes promoteColdRow {
    0% { transform: translateY(-30px) scale(.96); opacity: .25; }
    52% {
        transform: translateY(4px) scale(1.018);
        opacity: 1;
        border-color: #0ea5e9;
        box-shadow: 0 0 0 3px rgba(14,165,233,.2), 0 9px 24px rgba(2,132,199,.22);
    }
    100% { transform: none; opacity: .94; }
}
@keyframes promoteTileGlow {
    0%, 100% { transform: scale(1); }
    48% { transform: scale(1.08); }
}
.temperature-row.target {
    opacity: 1;
    min-height: 70px;
    border-width: 2px;
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    background: var(--bg-card);
    box-shadow: 0 8px 26px rgba(0,0,0,.10);
}
.temperature-row.target::before {
    background: linear-gradient(90deg, rgba(239,68,68,.08), transparent 45%, rgba(14,165,233,.09));
}
.row-word {
    display: flex;
    justify-content: center;
    gap: 5px;
    min-width: 0;
}
.word-tile {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(27px, 7vw, 43px);
    height: clamp(34px, 8vw, 49px);
    border: 1px solid rgba(127,127,127,.32);
    border-radius: 8px;
    background: rgba(255,255,255,.28);
    color: var(--text);
    font-size: clamp(1rem, 4vw, 1.38rem);
    font-weight: 500;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}
[data-theme="dark"] .word-tile { background: rgba(0,0,0,.18); }
.target .word-tile {
    border-color: var(--primary);
    background: var(--bg-subtle);
}
.temperature-row.empty .word-tile { color: transparent; border-style: dashed; }
.temperature-row.empty .row-word::after {
    content: attr(data-empty-label);
    align-self: center;
    color: var(--text-muted);
    font-size: .78rem;
}
.row-temperature {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding-right: 10px;
    font-size: .65rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-align: right;
}
.hot .row-temperature { color: #dc2626; }
.cold .row-temperature { color: #0284c7; }
.confirmed-letter {
    border-color: #22c55e;
    background: #22c55e;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(34,197,94,.2);
    font-weight: 500;
}
.target .word-tile.confirmed-letter {
    border-color: #16a34a;
    background: #22c55e;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(34,197,94,.28), 0 4px 12px rgba(34,197,94,.22);
}
.uncertainty-tile {
    cursor: pointer;
    overflow: visible;
}
.uncertainty-tile::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 2px dashed color-mix(in srgb, var(--primary) 78%, #22c55e);
    border-radius: 11px;
    pointer-events: none;
    animation: uncertainty-orbit 4s linear infinite;
}
@keyframes uncertainty-orbit {
    to { transform: rotate(360deg); }
}

.message {
    min-height: 22px;
    margin: 5px 0 0;
    color: #dc2626;
    font-size: .86rem;
    font-weight: 700;
    text-align: center;
}
.message.info { color: var(--text-muted); }
.guess-count { min-height: 18px; color: var(--text-muted); font-size: .76rem; text-align: center; }
.guess-entry { display: flex; align-items: center; justify-content: center; margin: 8px 0 12px; }
.input-tiles { display: flex; justify-content: center; gap: 5px; }
.input-tile {
    display: grid;
    place-items: center;
    width: clamp(31px, 8vw, 44px);
    height: clamp(39px, 9.5vw, 51px);
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 600;
    text-transform: uppercase;
}
.input-tile.filled { border-color: var(--primary); }
.input-tiles.shake { animation: shake .38s ease; }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%,75% { transform: translateX(-7px); }
    50% { transform: translateX(7px); }
}
.play-again-btn, .btn-primary, .btn-secondary {
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.btn-primary, .play-again-btn { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--bg-subtle); color: var(--text); border: 1px solid var(--border); }
.play-again-btn { display: block; margin: 4px auto 12px; }
.hidden { display: none !important; }

.keyboard { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.kb-row { display: flex; justify-content: center; gap: 4px; }
.kb-key {
    flex: 1 1 0;
    max-width: 44px;
    min-width: 22px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kb-key.wide { flex: 1.5 1 0; min-width: 44px; max-width: 64px; font-size: 18px; }
.kb-spacer { visibility: hidden; pointer-events: none; }
.kb-key:active { transform: scale(.95); }

.modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,.55);
}
.modal-card {
    width: min(100%, 450px);
    max-height: 88vh;
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 20px 55px rgba(0,0,0,.28);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-title { margin: 0; font-size: 1.2rem; }
.modal-close {
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 1.45rem;
    cursor: pointer;
}
.setting-row { margin: 14px 0; }
.setting-label { display: block; margin-bottom: 6px; font-size: .86rem; font-weight: 750; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text);
    cursor: pointer;
}
.pill.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.length-input, .note-input, .create-input, .share-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text);
    font: inherit;
}
.note-input { min-height: 88px; resize: vertical; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.help-list { padding-left: 22px; line-height: 1.55; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stat-cell { padding: 12px 6px; border-radius: 10px; background: var(--bg-subtle); text-align: center; }
.stat-num { font-size: 1.35rem; font-weight: 850; }
.stat-label { color: var(--text-muted); font-size: .72rem; }
.bookmark-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.bookmark-head { display: flex; justify-content: space-between; gap: 8px; }
.bookmark-word { font-size: 1.08rem; font-weight: 850; text-transform: uppercase; }
.bookmark-note, .muted { color: var(--text-muted); font-size: .82rem; }
.delete-bookmark { border: 0; background: transparent; cursor: pointer; }
.result-word { margin: 10px 0; font-size: 2rem; font-weight: 900; letter-spacing: .12em; text-align: center; text-transform: uppercase; }
.result-headline {
    margin-bottom: 4px;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
}
.result-headline.won { color: #16a34a; }
.result-headline.lost { color: #c0392b; }
[data-theme="dark"] .result-headline.lost { color: #ff7a6b; }
.result-meta {
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.bookmark-char-count {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}
.share-row { display: flex; gap: 6px; }
.possible-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px 0 4px;
}
.possible-letter {
    display: grid;
    place-items: center;
    width: 38px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
}
.toast {
    position: fixed;
    z-index: 1200;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(20px);
    padding: 9px 15px;
    border-radius: 999px;
    background: #18181b;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.confetti-burst {
    position: fixed;
    z-index: 2000;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.confetti-piece {
    position: absolute;
    top: -16px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: .95;
    animation: confetti-fall 3s cubic-bezier(.25,.9,.5,1) forwards;
}
@keyframes confetti-fall {
    to { transform: translate3d(0,110vh,0) rotate(720deg); opacity: 0; }
}

@media (max-width: 520px) {
    .hc-shell { padding: 10px 7px 18px; }
    .hc-topbar { align-items: center; }
    .hc-logo { max-width: 165px; font-size: 1rem; }
    .hc-actions { gap: 3px; }
    .icon-btn { min-width: 31px; height: 31px; padding: 0 5px; font-size: 15px; }
    .temperature-stage { margin-top: 10px; padding: 7px; border-radius: 14px; }
    .guess-stack { gap: 5px; }
    .temperature-row { min-height: 53px; }
    .temperature-row.target { min-height: 58px; }
    .row-temperature { padding-right: 5px; font-size: .53rem; }
    .kb-key { height: 46px; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
    .uncertainty-tile::after { animation: none; }
    .temperature-row.near.promoted,
    .temperature-row.near.promoted .word-tile { animation: none; }
    .confetti-burst { display: none; }
}
