/* Kiaulės plovimas — tik TopChess tokenai (tc-theme.css) ir komponentai (tc-components.css):
   kieti šešėliai, jokių gradientų, jokių išplaukusių šešėlių. */

.wash {
    width: min(100% - 28px, 920px);
    margin: clamp(18px, 4vw, 40px) auto 90px;
    color: var(--tc-ink);
}
.wash [hidden], .wash-modal[hidden], .wash-modal [hidden] { display: none; }

.wash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.wash-header h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 900; margin: 0; letter-spacing: -.02em; }

/* ---- Pagrindinė kortelė ------------------------------------------------ */
.wash-card { padding: 0; overflow: hidden; }

.wash-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 2px solid var(--tc-line);
    background: var(--tc-surface);
    font-variant-numeric: tabular-nums;
}
.wash-meter { display: flex; align-items: center; gap: 10px; font-weight: 800; flex: 1 1 220px; min-width: 0; }
.wash-meter progress {
    flex: 1 1 90px;
    max-width: 260px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--tc-line);
    border-radius: var(--tc-radius-pill);
    background: var(--tc-surface-2);
    overflow: hidden;
}
.wash-meter progress::-webkit-progress-bar { background: var(--tc-surface-2); }
.wash-meter progress::-webkit-progress-value { background: var(--tc-green); border-radius: var(--tc-radius-pill); transition: width 200ms var(--tc-ease); }
.wash-meter progress::-moz-progress-bar { background: var(--tc-green); border-radius: var(--tc-radius-pill); }
#wash-percent { min-width: 4ch; text-align: right; color: var(--tc-green-text); }

.wash-clock {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 14px;
    background: var(--tc-surface-2);
    border: 2px solid var(--tc-line);
    border-radius: var(--tc-radius);
}
.wash-clock__label { font-size: .78rem; font-weight: 700; color: var(--tc-ink-soft); }
#wash-time { font-size: 1.4rem; font-weight: 900; min-width: 5.5ch; text-align: right; color: var(--tc-ink); }

.wash .tc-btn, .wash-dialog .tc-btn { touch-action: manipulation; }
.wash-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wash-actions .tc-btn { min-height: 40px; }
.wash-actions .tc-btn--blue { color: var(--tc-ink); }
#wash-help { min-width: 40px; padding-inline: 0; }
#wash-sound[aria-pressed="true"] { background: var(--tc-green); border-color: var(--tc-green-deep); color: var(--tc-ink); box-shadow: 0 4px 0 var(--tc-green-deep); }
#wash-sound[aria-pressed="false"] { color: var(--tc-ink-soft); }

/* No min-height here: with aspect-ratio it would force the box wider than a phone screen. */
.wash-stage { position: relative; isolation: isolate; width: 100%; aspect-ratio: 1.8; background: var(--tc-surface-2); }
.wash-stage canvas { position: absolute; width: 100%; height: 100%; inset: 0; display: block; }
.wash-stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#wash-scene { touch-action: none; cursor: crosshair; overscroll-behavior: contain; }
#wash-scene:focus-visible { outline: 3px solid var(--tc-blue-deep); outline-offset: -3px; }
#wash-water { pointer-events: none; }

.wash-note { margin: 14px 2px 4px; color: var(--tc-ink); }
.wash-note--small { margin: 0 2px 6px; font-size: .84rem; color: var(--tc-ink-soft); }
.wash-error { min-height: 1.3em; margin: 4px 2px 12px; font-size: .9rem; font-weight: 700; color: var(--tc-red-text); }

/* ---- Greičiausi laikai ------------------------------------------------- */
.wash-leaders h2 { font-size: 1.15rem; font-weight: 900; margin: 0 0 6px; }
.wash-leaders ol { margin: 0; padding-left: 1.6em; }
.wash-leaders li { padding: 8px 2px; border-bottom: 2px solid var(--tc-line); font-weight: 700; }
.wash-leaders li:last-child { border-bottom: 0; }
.wash-leaders li span { float: right; font-variant-numeric: tabular-nums; font-weight: 900; }
.wash-leaders li[data-mine] { color: var(--tc-green-text); }
.wash-leaders p { margin: 6px 0 0; color: var(--tc-ink-soft); }
.wash-leaders p:empty { display: none; }

/* ---- Langai (mokymas ir pabaiga) --------------------------------------- */
.wash-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(27, 36, 48, 0.55);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.wash-dialog {
    position: relative;
    width: min(100%, 460px);
    padding: 24px;
    text-align: center;
    animation: washPop .22s var(--tc-ease);
}
.wash-dialog h2 { margin: 0 0 14px; font-size: 1.5rem; font-weight: 900; }
@keyframes washPop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

.wash-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--tc-ink-soft);
    font: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.wash-close:hover { background: var(--tc-surface-2); color: var(--tc-ink); }
.wash-close:focus-visible { outline: 3px solid var(--tc-blue-deep); outline-offset: 3px; }

.wash-final { margin: 0 auto 12px; max-width: 240px; }
.wash-final .tc-stat__value { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.wash-rank { min-height: 1.4em; margin: 0 0 12px; font-weight: 800; color: var(--tc-green-text); }

.wash-guest { display: grid; gap: 10px; margin: 0 0 12px; text-align: left; }
.wash-guest label { font-weight: 700; }
.wash-guest__row { display: flex; gap: 8px; flex-wrap: wrap; }
.wash-guest input {
    flex: 1 1 150px;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    font: inherit;
    font-size: 16px;
    color: var(--tc-ink);
    background: var(--tc-surface);
    border: 2px solid var(--tc-line);
    border-radius: var(--tc-radius);
}
.wash-guest input:focus-visible { outline: 3px solid var(--tc-blue-deep); outline-offset: 2px; border-color: var(--tc-blue-deep); }
.wash-guest a { font-size: .9rem; font-weight: 700; }
.wash-guest__hint { margin: 0; font-size: .88rem; color: var(--tc-ink-soft); }
.wash-xp { margin: 0 0 12px; }
.wash-xp .tc-badge { font-size: .95rem; padding: .3rem .9rem; }
.wash-status { min-height: 1.3em; margin: 0 0 12px; font-size: .92rem; font-weight: 700; color: var(--tc-ink-soft); }
.wash-status[data-bad] { color: var(--tc-red-text); }
.wash-dialog__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.wash-dialog__actions .tc-btn { min-height: 44px; }

/* ---- Mokymas ------------------------------------------------------------ */
.pw-presents {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0 0 8px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--tc-ink-soft);
}
.pw-presents-logo {
    display: block;
    line-height: 0;
    text-decoration: none;
    opacity: .92;
}
.pw-presents-logo:hover { opacity: 1; }
.pw-presents img {
    height: 17px;
    width: auto;
    display: block;
}
.wash-how { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; text-align: left; }
.wash-how li { display: flex; align-items: center; gap: 14px; font-weight: 800; }
.wash-mouse { flex: none; width: 44px; height: 58px; }
.wash-mouse__body { fill: var(--tc-surface); stroke: var(--tc-ink); stroke-width: 3; }
.wash-mouse__hot { fill: var(--tc-gold); }
.wash-mouse__hot--blue { fill: var(--tc-blue); }
.wash-mouse__line { fill: none; stroke: var(--tc-ink); stroke-width: 2.5; }
.wash-mouse__wheel { fill: var(--tc-surface-2); stroke: var(--tc-ink); stroke-width: 2; }
.wash-mouse__wheel--hot { fill: var(--tc-green); }
.wash-finger { flex: none; width: 52px; height: 52px; }
.wash-finger__tip { fill: var(--tc-gold); stroke: var(--tc-ink); stroke-width: 2.5; }
.wash-finger__target { fill: none; stroke: var(--tc-blue-deep); stroke-width: 2.5; }
.wash-finger__line { fill: none; stroke: var(--tc-blue-deep); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 0; }
.wash-how li.wash-how__finger { display: none; }
.wash-how__touch { margin: 0 0 8px; font-size: .92rem; color: var(--tc-ink-soft); }
#wash-start { margin-top: 8px; min-width: 180px; }

/* Touch screens: big targets, touch instructions, a bigger play area */
@media (pointer: coarse) {
    .wash-header .tc-btn, .wash-actions .tc-btn, .wash-dialog__actions .tc-btn, .wash-guest .tc-btn { min-height: 44px; }
    #wash-help { min-width: 44px; }
    .wash-note--small, .wash-how li.wash-how__mouse, .wash-how__touch { display: none; }
    .wash-how li.wash-how__finger { display: flex; }
    .wash-close { width: 44px; height: 44px; }
}
@media (orientation: landscape) and (max-height: 520px) {
    .wash-stage { aspect-ratio: auto; height: 78svh; }
}
@media (max-width: 640px) {
    .wash-stage { aspect-ratio: 1.1; max-height: 64svh; }
}
@media (max-width: 520px) {
    .wash-bar { padding: 10px 12px; }
    .wash-clock { order: 2; }
    .wash-actions { order: 3; width: 100%; }
    .wash-actions .tc-btn--primary { flex: 1 1 auto; }
    .wash-dialog { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .wash-dialog { animation: none; }
    .wash-meter progress::-webkit-progress-value { transition: none; }
}
