:root { --gray: #c0c0c0; --hi: #ffffff; --lo: #808080; --dk: #404040; --navy: #000080; --teal: #008080; --green: #008000; --font: "Segoe UI", Tahoma, "MS Sans Serif", Arial, Helvetica, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--teal); }
body { margin: 0; font: 14px/1.5 var(--font); color: #111; background: var(--teal); min-height: 100vh; }
.page { max-width: 720px; } .page.wide { max-width: 700px; margin: 0 auto; padding: 18px 12px 40px; }
.page-head { color: #fff; text-align: center; margin-bottom: 14px; }
.page-head .eyebrow { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.page-head h1 { margin: 2px 0 6px; font-size: 40px; letter-spacing: .01em; text-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.page-head .lede { margin: 0 auto; max-width: 560px; font-size: 15px; opacity: .95; }
/* the window */
.win { background: var(--gray); max-width: 640px; border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo), inset 1px 1px #dfdfdf, 4px 4px 0 rgba(0,0,0,.25); padding: 3px; width: 100%; margin: 0 auto; user-select: none; }
.win.max { max-width: none; }
.win.min .table-wrap, .win.min .statusbar, .win.min .menubar { display: none; }
.titlebar { display: flex; align-items: center; gap: 6px; height: 20px; padding: 0 3px 0 4px; background: linear-gradient(90deg, var(--navy), #1084d0); color: #fff; font-weight: 700; font-size: 13px; }
.title-icon { width: 14px; height: 14px; background: linear-gradient(#fff, #fff) content-box, var(--green); border: 1px solid #000; padding: 2px 3px; }
.title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-buttons { display: flex; gap: 2px; }
.title-buttons button, .dlg-buttons button, .desk-icon { font: 12px var(--font); }
.title-buttons button { width: 16px; height: 14px; padding: 0; line-height: 10px; font-weight: 700; color: #000; background: var(--gray); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo); cursor: pointer; }
.title-buttons button:active { border-color: var(--dk) var(--hi) var(--hi) var(--dk); }
.menubar { display: flex; height: 20px; padding: 1px 0; position: relative; }
.menu { position: relative; }
.menu > button { height: 18px; padding: 0 7px; border: 1px solid transparent; background: none; font: 12px var(--font); cursor: default; color: #000; }
.menu > button:hover, .menu > button[aria-expanded="true"] { border-color: var(--hi) var(--lo) var(--lo) var(--hi); }
.menu > button[aria-expanded="true"] { border-color: var(--lo) var(--hi) var(--hi) var(--lo); }
.dropdown { position: absolute; left: 0; top: 19px; z-index: 20; margin: 0; padding: 2px; list-style: none; min-width: 190px; background: var(--gray); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo), 2px 2px 0 rgba(0,0,0,.3); }
.dropdown li { margin: 0; }
.dropdown .sep { height: 0; margin: 3px 2px; border-top: 1px solid var(--lo); border-bottom: 1px solid var(--hi); }
.dropdown button { display: flex; width: 100%; justify-content: space-between; gap: 24px; padding: 3px 18px 3px 22px; border: 0; background: none; text-align: left; font: 12px var(--font); color: #000; cursor: default; position: relative; }
.dropdown button:hover, .dropdown button:focus { background: var(--navy); color: #fff; outline: none; }
.dropdown button:disabled { color: var(--lo); text-shadow: 1px 1px var(--hi); }
.dropdown button:disabled:hover { background: none; }
.dropdown button.checked::before { content: "✓"; position: absolute; left: 6px; }
.dropdown .key { opacity: .85; }
.table-wrap { border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); background: var(--green); line-height: 0; }
#table { display: block; margin: 0 auto; touch-action: none; outline: none; cursor: default; image-rendering: auto; }
#table:focus-visible { box-shadow: 0 0 0 2px #ffd400 inset; }
.statusbar { display: flex; gap: 3px; margin-top: 3px; font-size: 12px; }
.status-cell { padding: 1px 6px; border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); white-space: nowrap; min-height: 20px; }
.status-cell.grow { flex: 1; overflow: hidden; text-overflow: ellipsis; color: #400; }
.status-btn { background: none; font: 12px var(--font); cursor: pointer; color: #000; }
.status-btn:hover { text-decoration: underline; }
.noscript { color: #fff; text-align: center; }
/* the desktop after Exit */
.desktop { position: fixed; inset: 0; z-index: 50; background: var(--teal); padding: 24px; color: #fff; }
.desk-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; padding: 6px 2px; background: none; border: 1px dotted transparent; color: #fff; text-shadow: 1px 1px #000; cursor: pointer; }
.desk-icon:focus, .desk-icon:hover { border-color: #fff; background: rgba(0,0,128,.6); }
.desk-icon-art { width: 32px; height: 40px; background: #fff; border: 1px solid #000; border-radius: 3px; box-shadow: 4px 3px 0 var(--green), 5px 4px 0 #000; }
.desk-hint { position: absolute; left: 24px; bottom: 24px; margin: 0; font-size: 13px; opacity: .85; }
/* content panels */
.panel { background: var(--gray); max-width: 640px; border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo), inset 1px 1px #dfdfdf; padding: 14px 18px; margin: 18px auto 0; }
.panel h2 { font-size: 17px; margin: 6px 0 8px; }
.panel h3 { font-size: 14px; margin: 14px 0 2px; }
.panel p { margin: 4px 0 8px; }
.steps { padding-left: 22px; margin: 0 0 10px; }
.steps li { margin: 0 0 8px; }
.cols { columns: 2 260px; column-gap: 22px; padding-left: 20px; margin: 0 0 10px; }
.cols li { margin-bottom: 5px; break-inside: avoid; }
.keys { border-collapse: collapse; width: 100%; font-size: 13px; }
.keys th { text-align: left; white-space: nowrap; padding: 3px 10px 3px 0; font-weight: 700; }
.keys td { padding: 3px 18px 3px 0; }
.foot { color: #fff; text-align: center; font-size: 13px; margin-top: 22px; }
.foot a { color: #fff; }
/* dialogs */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; padding: 12px; }
.dialog { background: var(--gray); border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo), inset 1px 1px #dfdfdf, 5px 5px 0 rgba(0,0,0,.3); padding: 3px; min-width: 280px; max-width: min(92vw, 420px); font-size: 12px; }
.dialog.wide { max-width: min(92vw, 520px); }
.dlg-title { background: linear-gradient(90deg, var(--navy), #1084d0); color: #fff; font-weight: 700; padding: 2px 6px; font-size: 13px; }
.dlg-body { padding: 14px 12px 6px; }
.dlg-body label { display: block; margin-bottom: 6px; }
.dlg-body input[type="number"] { width: 120px; font: 13px var(--font); padding: 2px 4px; border: 2px inset var(--lo); background: #fff; }
.dlg-note { color: #333; margin: 6px 0 0; }
.opts label { margin: 0 0 8px; }
.dlg-body.msg { display: flex; gap: 14px; align-items: flex-start; }
.dlg-body.msg p { margin: 0; white-space: pre-line; }
.msg-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font: 700 22px/32px Georgia, serif; text-align: center; }
.dlg-buttons { display: flex; justify-content: center; gap: 6px; padding: 8px 8px 10px; }
.dlg-buttons button { min-width: 76px; padding: 4px 10px; background: var(--gray); color: #000; border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); box-shadow: inset -1px -1px var(--lo), inset 1px 1px #dfdfdf; cursor: pointer; }
.dlg-buttons button.default { outline: 1px solid #000; }
.dlg-buttons button:active { border-color: var(--dk) var(--hi) var(--hi) var(--dk); }
.dlg-buttons button:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.stats { border-collapse: collapse; }
.stats th { text-align: left; padding: 3px 12px 3px 0; }
.stats td { padding: 3px 12px 3px 0; }
.tabs { display: flex; gap: 0; margin-bottom: -1px; position: relative; z-index: 1; }
.help-tab { font: 12px var(--font); padding: 3px 10px; background: var(--gray); border: 1px solid; border-color: var(--hi) var(--dk) transparent var(--hi); border-radius: 3px 3px 0 0; cursor: pointer; color: #000; }
.help-tab[aria-selected="true"] { position: relative; top: 1px; padding-top: 4px; }
.help-panel { border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); padding: 6px 10px; min-height: 130px; background: var(--gray); }
.help-panel p { margin: 4px 0 8px; }
.about-body a { color: var(--navy); }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: #222; color: #fff; padding: 7px 12px; font-size: 13px; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 200; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 520px) { .page { padding: 12px 6px 30px; } .page-head h1 { font-size: 32px; } .win { padding: 2px; } .panel { padding: 12px 12px; } .dropdown .key { display: none; } }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

.radios { border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); padding: 6px 10px 4px; margin: 10px 0 0; }
.radios legend { padding: 0 4px; }
.radios label { margin: 4px 0; }
.stats.grid th, .stats.grid td { text-align: right; padding: 3px 10px; }
.stats.grid th:first-child { text-align: left; }
.note { font-size: 13px; color: #222; }
.desk-icon-art { box-shadow: 4px 3px 0 var(--green), 5px 4px 0 #000, 8px 6px 0 #1f4fa3, 9px 7px 0 #000; }

/* Solitaire: status bar reads Score / Time at the right like the original; deck chooser grid; option fieldsets side by side */
.statusbar .status-cell.grow { flex: 1; text-align: left; }
#status-score, #status-time { min-width: 84px; text-align: left; }
.deck-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.deck-back { padding: 3px; background: none; border: 2px solid transparent; cursor: pointer; line-height: 0; }
.deck-back canvas { width: 100%; height: auto; display: block; }
.deck-back[aria-checked="true"] { border-color: var(--navy); background: rgba(0,0,128,.12); }
.deck-back:focus-visible { outline: 1px dotted #000; }
.opt-row { display: flex; gap: 10px; }
.opt-row .radios { flex: 1; margin-top: 0; }
.opt-row.checks { flex-wrap: wrap; margin-top: 10px; }
.opt-row.checks label { flex: 1 1 45%; margin: 0 0 6px; }
.ours { margin: 4px 0 0; color: #333; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--lo); padding: 0 4px; margin-left: 4px; color: #333; }
@media (max-width: 520px) { .deck-grid { grid-template-columns: repeat(4, 1fr); } .opt-row { flex-direction: column; } }
/* Phones: let the status bar wrap instead of pushing the page sideways (Game #1000000 · Draw Three + Score + Time is wider than 320px). */
@media (max-width: 520px) { .statusbar { flex-wrap: wrap; } #status-game { flex: 1 1 auto; text-align: left; } #status-score, #status-time { min-width: 0; } }
/* Phones: the seven-column Statistics grid is wider than the dialog; tighten it and let it scroll rather than clip. */
@media (max-width: 520px) { #dlg-stats .dlg-body { overflow-x: auto; } .stats.grid th, .stats.grid td { padding: 3px 3px; font-size: 11px; } }
