/* Minesweeper 2.0 web: the same retro gray look as the desktop game. */

:root {
    --face: #c0c0c0;
    --light: #ffffff;
    --shadow: #808080;
    --dark: #404040;
    --hover: #d0d0d0;
    --checked: #a0a0a0;
    --locked: #acacac;
    --ink: #000000;
    --muted: #404040;
    --mine: #0046aa;
    --error: #b22222;
    --page: #008080;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--page);
}

button { font: inherit; color: inherit; }

/* Raised and sunken 3D edges */
.raised, .mode-button, .button, .face-button, .level-button, .toggle, .panel, .dialog {
    background: var(--face);
    border: 2px solid;
    border-color: var(--light) var(--dark) var(--dark) var(--light);
}
.sunken {
    border: 2px solid;
    border-color: var(--shadow) var(--light) var(--light) var(--shadow);
}

/* Screens */
.screen { padding: 16px; }
.screen.center { display: flex; justify-content: center; align-items: flex-start; }
.panel { padding: 24px; width: 100%; }
.panel.narrow { max-width: 468px; }
.panel.wide { max-width: 740px; }
h1 { margin: 0; text-align: center; font-size: clamp(22px, 6vw, 30px); letter-spacing: 1px; }
.hint { text-align: center; margin: 4px 0 16px; }
.note { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }

.mode-button {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
    padding: 10px 12px; min-height: 72px; cursor: pointer; text-align: center; width: 100%;
}
.mode-button strong { font-size: 17px; }
.mode-button span { font-size: 13px; color: var(--muted); }
.mode-button:hover:not(:disabled):not(.locked) { background: var(--hover); }
.mode-button:active:not(:disabled):not(.locked), .mode-button.checked {
    border-color: var(--dark) var(--light) var(--light) var(--dark);
    background: var(--checked);
}
.mode-button.small { min-height: 40px; font-weight: 600; }
.mode-button.locked { background: var(--locked); cursor: default; }
.mode-button:disabled { color: var(--shadow); cursor: default; }
:focus-visible { outline: 2px dotted var(--ink); outline-offset: -5px; }

/* Player picker */
.player-list {
    background: #fff; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow);
    height: 220px; overflow-y: auto; margin-bottom: 12px;
}
.player {
    display: block; width: 100%; text-align: left; padding: 4px 8px; font-size: 20px;
    background: none; border: 0; cursor: pointer;
}
.player.selected { background: #000080; color: #fff; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Start screen */
.modes { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.mode-row { display: grid; grid-template-columns: 1fr 260px; gap: 12px; }
.scores {
    background: #fff; border: 1px solid var(--shadow); font-size: 13px; min-height: 72px; max-height: 110px; overflow-y: auto;
}
.scores-header { background: #e2e2e2; font-weight: 700; padding: 1px 6px; position: sticky; top: 0; }
.score { display: flex; justify-content: space-between; gap: 8px; padding: 0 6px; }
.score span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score.mine { font-weight: 700; color: var(--mine); }
.score.empty { color: gray; }
.start-footer { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin-top: 16px; }
.tile-sizes .label { text-align: center; margin-bottom: 4px; }
.tile-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.score-toggle { min-height: 0; }
.switch { margin-top: 24px; max-width: calc(50% - 6px); }

@media (max-width: 640px) {
    .mode-row, .start-footer { grid-template-columns: 1fr; }
    .scores { height: auto; max-height: 96px; }
    .switch { max-width: none; }
}

/* Game screens */
/* Room the board leaves for everything around it, sideways and above/below (see BoardView.SizeStyle). */
.game-screen {
    padding: 8px;
    --board-side: 48px; --board-chrome: 180px;
}
.game-window {
    background: var(--face); padding: 10px; border: 2px solid;
    border-color: var(--light) var(--dark) var(--dark) var(--light);
}
.game-header {
    display: flex; justify-content: space-between; align-items: center; padding: 6px; margin-bottom: 6px;
}
.game-toolbar {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 30px;
}
.game-caption { font-size: 14px; font-weight: 600; }
.toggle { padding: 2px 10px; cursor: pointer; font-size: 14px; }
.toggle.on { border-color: var(--dark) var(--light) var(--light) var(--dark); background: var(--checked); }
/* Boards shrink to fit (BoardView.SizeStyle) but never below their minimum; a smaller window scrolls the page. */
.board-area { position: relative; }
svg.board {
    display: block;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.tile-number { font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }

.paused-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 8px; cursor: pointer;
}
.paused-overlay strong { font-size: 44px; }
.paused-overlay span { color: #555; }

.led {
    position: relative; background: #000; width: 62px; height: 32px; font-family: Consolas, "Courier New", monospace;
    font-weight: 700; font-size: 22px; display: flex; align-items: center; justify-content: center;
}
.led span { position: absolute; letter-spacing: 1px; }
.led-ghost { color: #3c0000; }
.led-lit { color: #ff1e1e; }

.face-button { width: 38px; height: 38px; padding: 1px; cursor: pointer; }
.face-button:active { border-color: var(--dark) var(--light) var(--light) var(--dark); }

/* Menu bar */
.menubar { display: flex; background: var(--face); margin-bottom: 8px; border: 1px solid var(--shadow); }
.menu { position: relative; }
.menu-title { background: none; border: 0; padding: 4px 12px; cursor: pointer; }
.menu-title.open, .menu-title:hover { background: #000080; color: #fff; }
.menu-list {
    position: absolute; top: 100%; left: 0; z-index: 20; min-width: 220px; background: var(--face);
    border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); padding: 2px;
}
.menu-item {
    display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; width: 100%; text-align: left;
    background: none; border: 0; padding: 4px 8px; cursor: pointer;
}
.menu-item:hover:not(:disabled) { background: #000080; color: #fff; }
.menu-item:disabled { color: var(--shadow); cursor: default; }
.menu-shortcut { opacity: 0.8; }
.menu-separator { border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--light); margin: 3px 2px; }
.menu-backdrop { position: fixed; inset: 0; z-index: 10; }

/* Dialogs */
.dialog-backdrop {
    position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.25);
    display: flex; justify-content: center; align-items: center; padding: 16px;
}
.dialog { min-width: 280px; max-width: 520px; width: auto; max-height: 90vh; overflow: auto; }
.dialog-title { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: 700; padding: 3px 8px; }
.dialog-body { padding: 12px 16px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 12px; }
.button { min-width: 80px; padding: 4px 12px; cursor: pointer; }
.button:active { border-color: var(--dark) var(--light) var(--light) var(--dark); }
.pre { white-space: pre-line; margin: 0; }
.form-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.form-grid input { font: inherit; padding: 2px 4px; width: 100%; min-width: 120px; }
.error { color: var(--error); margin: 8px 0 0; }
.controls { border-collapse: collapse; font-size: 14px; }
.controls th { text-align: left; padding: 8px 0 4px; }
.controls td { padding: 2px 12px 2px 0; vertical-align: top; }

.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.level-button { min-height: 52px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.level-button.current span { font-weight: 800; }
.level-button:disabled { color: var(--shadow); cursor: default; }
.level-button small { font-size: 11px; }

/* Banners and errors */
.banner {
    background: #ffffe1; border-bottom: 1px solid var(--shadow); padding: 6px 16px; text-align: center; font-size: 14px;
}
.link { background: none; border: 0; text-decoration: underline; cursor: pointer; }
.error-panel { max-width: 460px; text-align: center; }
.error-panel .detail { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); }

.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; color: #fff; }
.loading-title { font-size: 28px; font-weight: 700; }

#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* The menu bar spans the game window's width. */
/* Centered while it fits; wider than the window, it starts at the left edge so the page can scroll to all of it. */
.game-column { display: flex; flex-direction: column; width: fit-content; margin: 0 auto; }
.game-column .menubar { margin-bottom: 0; border-bottom: 0; }

/* Lets Enter submit a form with several fields; the visible OK button sits in the dialog footer. */
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; }
