/* Terrace layout and functional chess presentation; piece art is deliberately provisional. */
:root{--terrace-ink:#eee1c4;--terrace-gold:#d7b873;--terrace-line:#67563c}
#terrace-dialog,#terrace-chess{box-sizing:border-box;color:var(--terrace-ink);background:#191b16;border:1px solid var(--terrace-line);border-radius:10px;box-shadow:0 18px 80px #000a;font:16px/1.55 Georgia,serif;padding:28px;max-height:92dvh;overflow:auto}
#terrace-dialog{width:min(580px,94vw)}#terrace-chess{width:min(940px,96vw)}
#terrace-dialog::backdrop,#terrace-chess::backdrop{background:#080b08b8;backdrop-filter:blur(3px)}
#terrace-dialog h2,#terrace-chess h2{font-size:29px;font-weight:400;line-height:1.2;margin:6px 0 15px}#terrace-chess h3{font-size:17px;font-weight:400}
.terrace-eyebrow{text-transform:uppercase;font:10px/1.4 system-ui,sans-serif;letter-spacing:.19em;color:var(--terrace-gold)}
#terrace-dialog button,#terrace-chess button,#terrace-actions button,#terrace-watch button{box-sizing:border-box;min-height:44px;border:1px solid var(--terrace-line);border-radius:5px;background:#282b21;color:var(--terrace-ink);font:14px/1.3 system-ui,sans-serif;padding:10px 13px;cursor:pointer}
#terrace-dialog button:hover,#terrace-chess button:hover,#terrace-actions button:hover,#terrace-watch button:hover{background:#3a3d2c;border-color:var(--terrace-gold)}
#terrace-dialog button:focus-visible,#terrace-chess button:focus-visible,#terrace-actions button:focus-visible,#terrace-watch button:focus-visible{outline:3px solid #f5cf6e;outline-offset:2px}
#terrace-dialog button:disabled,#terrace-chess button:disabled{opacity:.4;cursor:default}
.terrace-dialog-close{position:absolute;right:13px;top:12px;font-size:23px!important;background:none!important;border:0!important}
.terrace-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:22px}
.terrace-tracks{display:grid;gap:7px;margin-top:20px}.terrace-tracks button{display:flex;align-items:center;text-align:left;gap:13px;width:100%}.terrace-tracks button>span:nth-child(2){flex:1}.terrace-tracks strong{font:16px Georgia,serif}.terrace-tracks small{display:block;color:#a8aa94;margin-top:5px;font-size:11px}.terrace-tracks [aria-pressed=true]{border-color:var(--terrace-gold)!important;background:#3b3b27!important}.track-number{font:12px ui-monospace,monospace;color:var(--terrace-gold)}
.terrace-player{border-top:1px solid #4a4b37;margin-top:22px;padding-top:12px}.terrace-player label{display:block;font:12px system-ui,sans-serif;margin-top:14px}.terrace-player input{display:block;width:100%;min-height:32px;accent-color:#d7b873}.terrace-player .terrace-actions{margin-top:10px}
#terrace-actions{position:fixed;bottom:calc(80px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);z-index:35;display:flex;gap:6px;max-width:94vw;padding:7px;border:1px solid #806f4d;background:#151c15eb;border-radius:8px;white-space:nowrap}#terrace-actions[hidden]{display:none}
#terrace-watch{position:fixed;left:18px;top:18px;max-width:275px;background:#162017e8;color:#f0e4c9;border:1px solid #b3986080;border-radius:8px;padding:14px 17px;z-index:32;font:14px/1.5 Georgia,serif;box-shadow:0 5px 30px #0004}#terrace-watch[hidden]{display:none}#terrace-watch p{margin:6px 0 10px}#terrace-watch button{font-size:11px;min-height:36px;padding:6px 10px}
.terrace-object,.terrace-attendant{border:0!important;background:transparent!important;box-shadow:none!important}.terrace-object:focus-visible,.terrace-attendant:focus-visible{outline:2px solid #f0cf69;outline-offset:2px}
.terrace-object:hover,.terrace-attendant:hover{outline:1px solid #edcf7999}.terrace-seat .label{opacity:1!important}.terrace-seat{border:1px solid #e1c88280!important;background:#302c1820!important}
.terrace-chess-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.terrace-chess-head p{font-size:13px;color:#aaa991;margin:0 0 14px}.terrace-chess-head>button{background:none!important;border:0!important;font-size:22px!important}
.terrace-chess-layout{display:grid;grid-template-columns:minmax(260px,1fr) 220px;gap:28px}.terrace-chess-layout>section{min-width:0}#terrace-chess-status{margin:0 0 10px;min-height:25px;color:#e9c97b;font:14px/1.5 system-ui,sans-serif}.terrace-board{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;width:100%;border:7px solid #6c5033;box-sizing:border-box;box-shadow:0 6px 25px #0005}
#terrace-chess .chess-square{position:relative;border:0;border-radius:0;padding:0;min-width:0;min-height:0;aspect-ratio:1;font:clamp(22px,4.5vw,49px)/1 'Times New Roman',serif;display:flex;align-items:center;justify-content:center;isolation:isolate}
#terrace-chess .chess-square.light{background:#dcc79e}#terrace-chess .chess-square.dark{background:#7c8462}#terrace-chess .chess-square.piece-w{color:#fff6da;text-shadow:0 1px 2px #000,-1px 0 #443a22,1px 0 #443a22}#terrace-chess .chess-square.piece-b{color:#1d261f;text-shadow:0 1px 0 #f4e7c0}
#terrace-chess .chess-square.last-move{background:#b4b16b}#terrace-chess .chess-square.selected{background:#e0b954;box-shadow:inset 0 0 0 3px #f9df95}#terrace-chess .chess-square.in-check{background:#c56c53}.chess-square.legal:after{content:'';position:absolute;width:24%;height:24%;border-radius:100%;background:#203c2280;z-index:-1}.chess-square.legal[class*=piece-]:after{width:85%;height:85%;background:none;border:3px solid #1f4e2790;box-sizing:border-box}
.chess-square small{position:absolute;bottom:1px;left:3px;font:8px system-ui,sans-serif;color:#273124a0;text-shadow:none}.chess-square span{pointer-events:none}
.chess-help{font:11px/1.6 system-ui,sans-serif;color:#aaa991}.chess-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:15px}.chess-actions button{font-size:12px!important;padding:8px!important}.terrace-chess-layout aside label{font:12px system-ui,sans-serif;display:block}.terrace-chess-layout select{width:100%;min-height:44px;background:#262c20;color:#eee1c4;border:1px solid #67563c;border-radius:4px;padding:6px;margin-top:6px}
.chess-history{max-height:180px;overflow:auto;padding-left:30px;font:13px/1.8 ui-monospace,monospace}.chess-history li{padding-left:6px}.chess-history li span{display:inline-block;min-width:66px}.chess-empty{font:12px system-ui,sans-serif;list-style:none;color:#aaa991;margin-left:-30px}.chess-message{font:12px system-ui,sans-serif;color:#e9b88b}.chess-confirm{position:sticky;bottom:-15px;background:#363322;border:1px solid #a9894e;padding:14px;border-radius:5px;box-shadow:0 0 50px #0009}.chess-confirm[hidden]{display:none}.chess-promotion{border:1px solid #d7b873;margin-top:10px;padding:10px}.chess-promotion p{margin:0 0 8px}
@media(max-width:650px){#terrace-chess{padding:16px;width:98vw;max-height:96dvh}.terrace-chess-layout{grid-template-columns:1fr;gap:12px}.terrace-chess-head p{font-size:11px}.terrace-chess-head h2{font-size:25px!important;margin-bottom:7px!important}.terrace-board{max-width:460px;margin:auto;border-width:5px}#terrace-chess .chess-square{font-size:clamp(24px,8.6vw,45px)}.terrace-chess-layout aside{border-top:1px solid #484b36;padding-top:12px}.chess-actions{grid-template-columns:repeat(3,1fr)}.chess-history{max-height:110px}#terrace-dialog{padding:24px 19px}#terrace-watch{left:12px;top:calc(62px + env(safe-area-inset-top));max-width:230px;padding:10px 13px;font-size:12px}#terrace-actions{bottom:calc(132px + env(safe-area-inset-bottom));padding:5px}#terrace-actions button{font-size:12px;padding:8px 10px}}
@media(orientation:landscape) and (max-height:520px){#terrace-chess{padding:12px 20px;max-height:98dvh}.terrace-chess-layout{grid-template-columns:minmax(220px,1fr) 190px;gap:18px}.terrace-board{max-width:300px}.terrace-chess-head p{display:none}.terrace-chess-head h2{font-size:22px!important;margin-bottom:5px!important}.terrace-eyebrow{font-size:9px}#terrace-chess-status{font-size:12px;margin-bottom:5px}#terrace-chess .chess-square{font-size:30px}#terrace-watch{top:10px;left:75px;max-width:210px;font-size:11px}#terrace-actions{bottom:12px;left:50%}.terrace-chess-layout aside{border:0;padding:0}.chess-actions{grid-template-columns:1fr 1fr}}

.terrace-window-view{width:100%;height:auto;border-radius:5px}
@media(max-width:650px){#terrace-chess{max-width:98vw}}
@media(max-width:360px){#terrace-chess{padding:12px}.terrace-chess-head p{font-size:10px}.terrace-chess-head h2{font-size:23px!important}}
@media(orientation:landscape) and (max-height:520px){.terrace-board{max-width:min(300px,calc(100dvh - 118px))}}
@media(min-width:651px) and (min-height:521px){.terrace-board{max-width:min(520px,calc(92dvh - 240px));margin-inline:auto}}
@media(orientation:landscape) and (max-height:520px){#terrace-actions{bottom:64px}#terrace-watch{font:11px/1.35 Georgia,serif;padding:9px 12px;max-width:220px}#terrace-watch p{max-height:44px;overflow:auto;margin:4px 0 7px}#terrace-watch button{min-height:32px;font-size:10px;padding:5px 8px}}

html[data-terrace=seated] #background{transition:opacity 180ms ease}html[data-terrace=seated] #background.terrace-still-fade{opacity:.18}
@media(prefers-reduced-motion:reduce){html[data-terrace=seated] #background{transition:none}}
