/* Old paper and dark wood. */
/* Fraunces and Inter, SIL Open Font License (see fonts/). */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/fraunces-400.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/fraunces-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/fraunces-700.woff2') format('woff2'); }
@font-face { font-family: 'Perfect DOS VGA 437'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/perfect-dos-vga-437.woff2') format('woff2'); unicode-range: U+0020-007E; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-700.woff2') format('woff2'); }
:root {
  --paper: #f1e4c3; --paper-light: #fbf3dc; --ink: #2f2111; --wood: #4a2f16; --wine: #7a2617; --gold: #b8903f; --line: #9a7b46;
  --text: 'Inter', system-ui, sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.04' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .1 0 0 0 .5 -.16'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
body { margin: 0; background: var(--paper) var(--grain); color: var(--ink); font: 16px/1.45 var(--text); }
main { max-width: 30rem; margin: 0 auto; padding: 1.5rem 1rem; }
h1 { margin: 0 0 1rem; color: var(--wine); }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; color: var(--wine); }
label { display: block; margin-bottom: .25rem; }
input, button { font: inherit; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 4px; }
input { background: #fffdf7; min-width: 0; }
#link { flex: 1; }
/* A link that looks and works like a button. */
a.cta { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; padding: .5rem .75rem; border: 1px solid; border-radius: 4px; text-decoration: none; }
a.cta:hover { filter: brightness(1.12); }
a.cta:active { transform: translateY(1px); }
button, a.cta { background: linear-gradient(#8d3220, #66200f); color: #fbf0d5; border-color: #3f1408; box-shadow: inset 0 0 0 1px #d8ab5566, 0 2px 3px #0003; cursor: pointer; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.quiet { background: var(--paper-light); color: var(--wood); border-color: var(--line); box-shadow: 0 1px 2px #0002; }
form { display: grid; gap: .6rem; }
form label { margin: 0; }
form small { margin-top: -.35rem; color: #75684c; font-size: .8rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions { margin-top: 1.5rem; }
.notice { background: #f6d9c9; padding: .6rem .8rem; border-radius: 4px; }
ul { list-style: none; margin: 0; padding: 0; }
li { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid #ddd1b5; }
li .tags { color: #75684c; font-size: .85rem; flex: 1; }
li button { padding: .15rem .5rem; font-size: .85rem; }
.dot { width: 1rem; height: 1rem; border-radius: 50%; flex: none; }
.swatch { width: 2.4rem; height: 2.4rem; padding: 0; border: 3px solid transparent; border-radius: 50%; }
.swatch[aria-pressed="true"] { border-color: #2b2418; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .3rem .4rem .3rem 0; border-bottom: 1px solid #ddd1b5; }
.inline { display: inline-block; margin-right: .5rem; vertical-align: -.1rem; }
.tags { color: #75684c; font-size: .85rem; }

/* The short rules below the entry form */
#rules { margin-top: 1.5rem; font-size: .95rem; }
#rules h2 { margin-top: 0; }
#rules h3 { margin: .9rem 0 .25rem; font-size: 1rem; color: var(--wine); }
#rules p { margin: .25rem 0; }
#rules ol, #rules ul { margin: 0; padding-left: 1.25rem; list-style-position: outside; }
#rules ol { list-style: decimal; }
#rules ul { list-style: disc; }
#rules li { display: list-item; padding: .1rem 0; border: 0; }
#hand .different { margin: .4rem 0 0; font-weight: bold; }

/* Running game. Narrow screens stack everything; wide screens fill one window. */
body.playing main { max-width: 42rem; padding: .5rem; }
body.playing h1 { display: none; }
/* Messages float, so the board does not jump when one appears. */
body.playing .notice { position: fixed; z-index: 1; top: .5rem; left: 50%; transform: translateX(-50%); margin: 0; box-shadow: 0 2px 8px #0004; }
.statusbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.statusbar h2, .statusbar p { margin: 0; }
.clockbar { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
/* A quiet speaker icon next to the clock. */
#sound { display: inline-flex; padding: .2rem; border: 0; background: none; box-shadow: none; color: var(--wood); opacity: .65; }
#sound:hover, #sound:focus-visible { opacity: 1; }
#sound .speaker { fill: currentColor; }
#sound .waves, #sound .cross { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#sound .cross, #sound.off .waves { display: none; }
#sound.off .cross { display: inline; }
#panel { display: flex; flex-wrap: wrap; align-content: center; align-items: center; gap: .25rem .75rem; background: var(--paper-light); border: 3px double var(--line); border-radius: 6px; box-shadow: 0 2px 6px #5a3b1033; padding: .4rem .6rem; min-height: 3.6rem; margin-top: .35rem; }
#panel p { margin: 0; }
#panel input, #panel button, #hand button, #hand select, .info button, .info a.cta { padding: .3rem .6rem; font-size: .9rem; }
.number { width: 4.5rem; }
#hand strong { margin-right: .25rem; }
/* One colour per card symbol, so that a set is visible at a glance. The name stays on the card. */
#hand .card { color: var(--ink); border: 2px solid #5a3d18; box-shadow: 0 2px 3px #0003; font-weight: 700; }
#hand .card.zwaard { background: #f2a58f; }
#hand .card.schild { background: #a9cdf0; }
#hand .card.kroon { background: #f7d65c; }
#hand .card.heraut { background: linear-gradient(100deg, #f2a58f 0 33%, #f7d65c 33% 66%, #a9cdf0 66%); }
#hand .card:disabled { opacity: 1; }
#hand .card[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; transform: translateY(-2px); }
#hand .card[aria-pressed="true"]::before { content: '✓ '; }
#hand .hint { margin: .25rem 0 0; font-size: .8rem; }
.die { display: inline-grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 2rem; height: 2rem; padding: .25rem; box-sizing: border-box; border-radius: .4rem; box-shadow: 0 2px 4px #0005, inset 0 -2px 3px #0003; }
.die i { place-self: center; width: .36rem; height: .36rem; border-radius: 50%; }
.die.attacker { background: #8d2a1a; }
.die.attacker .pip { background: #fbf0d5; }
.die.defender { background: #fbf3dc; border: 1px solid var(--line); }
.die.defender .pip { background: var(--ink); }
#battle p { margin: .5rem 0 .25rem; font-size: .85rem; }
#battle .row { gap: .3rem; }
.info, aside { font-size: .9rem; }
aside .tabs { display: flex; gap: .35rem; margin: .6rem 0 .25rem; }
aside .tabs button { padding: .25rem .8rem; font-size: 1rem; }
aside .tabs button[aria-pressed="false"] { background: var(--paper-light); color: var(--wood); border-color: var(--line); box-shadow: 0 1px 2px #0002; }
#unread { display: inline-block; min-width: 1.2rem; margin-left: .25rem; border-radius: .6rem; background: var(--wine); color: #fff6dc; font-size: .75rem; font-variant: normal; line-height: 1.2rem; text-align: center; }

/* Chat: in the lobby below the players, during a game in the side column. */
#chat { display: flex; flex-direction: column; gap: .35rem; min-height: 0; font-size: .85rem; }
#messages { list-style: none; margin: 0; padding: .25rem .5rem; height: 14rem; overflow-y: auto; background: var(--paper-light); border: 3px double var(--line); border-radius: 6px; box-shadow: 0 2px 6px #5a3b1033; line-height: 1.35; }
#messages li { align-items: baseline; gap: .4rem; padding: .15rem 0; border: 0; }
#messages .said { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#messages .mute { padding: 0 .35rem; font-size: .7rem; opacity: .7; }
#chat p { margin: 0; }
#muted button { margin-right: .25rem; padding: .1rem .4rem; font-size: .75rem; }
#chaterror { color: var(--wine); font-weight: 700; }
#chatform { display: flex; gap: .35rem; }
#chattext { flex: 1; }
#chatform input, #chatform button { padding: .3rem .6rem; font-size: .9rem; }
#hand { margin: .25rem 0 .5rem; }
.info th, .info td { padding: .15rem .3rem .15rem 0; }
.info th { font-size: .8rem; }
#log { list-style: none; margin: 0 0 .5rem; padding: .25rem .5rem; height: 14rem; overflow-y: auto; background: var(--paper-light); border: 3px double var(--line); border-radius: 6px; box-shadow: 0 2px 6px #5a3b1033; font-size: .85rem; line-height: 1.35; }
#log li { align-items: baseline; gap: .4rem; padding: .15rem 0; border: 0; }
#log li.turn { border-top: 1px solid #ddd1b5; font-weight: 700; margin-top: .25rem; padding-top: .35rem; }
#log .dot { width: .6rem; height: .6rem; }

.boardwrap { overflow: hidden; overflow: clip; margin: .35rem 0; }
#zoom { height: 100%; transform-origin: 0 0; }
#board { display: block; width: 100%; height: 100%; }
.zoombuttons, #views { display: none; }

/* Map on the left; what you do next to it; the log in its own column if there is room. */
@media (min-width: 56rem) and (min-height: 30rem) {
  body.playing { height: 100vh; height: 100dvh; overflow: hidden; }
  body.playing main { max-width: none; height: 100%; box-sizing: border-box; }
  #started { display: grid; height: 100%; gap: .5rem .75rem; grid-template-columns: minmax(0, 1fr) 21rem; grid-template-rows: auto minmax(0, auto) minmax(11rem, 1fr); grid-template-areas: "board top" "board info" "board log"; }
  .top { grid-area: top; }
  .info { grid-area: info; min-height: 0; overflow-y: auto; max-height: 55vh; }
  .boardwrap { grid-area: board; min-height: 0; margin: 0; }
  aside { grid-area: log; display: flex; flex-direction: column; min-height: 0; }
  aside .tabs { margin-top: 0; }
  #log { flex: 1; height: auto; min-height: 0; margin: 0; }
  #gamechat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  #gamechat #chat { flex: 1; }
  #gamechat #messages { flex: 1; height: auto; min-height: 3rem; }
}
@media (min-width: 78rem) and (min-height: 30rem) {
  #started { grid-template-columns: minmax(0, 1fr) 22rem 19rem; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "board top log" "board info log"; }
  .info { max-height: none; }
}

#board text { text-anchor: middle; pointer-events: none; font-family: var(--text); fill: var(--ink); }
#board .quiet-layer { pointer-events: none; }

/* Sea and surroundings */
#board .sea { fill: #faedc8; }
#board .wave { fill: none; stroke: #7d6a42; stroke-width: 1.1; opacity: .4; }
#board .shallow { fill: none; stroke: #6f9690; stroke-linejoin: round; opacity: .18; }
#board .abroad { fill: #eed9a2; stroke: #8b6f3e; stroke-width: 1.5; stroke-linejoin: round; }
#board .paper { fill: #f1e4c3; }

/* The scroll itself */
#board .sheet-shadow { fill: #faedc8; filter: drop-shadow(1px 4px 6px #6b431266); }
#board .stains { opacity: .42; mix-blend-mode: multiply; }
#board .scorch { fill: none; stroke: #d39a3c; stroke-linejoin: round; opacity: .13; }
#board .edge { fill: none; stroke: #a9782f; stroke-width: 2.5; stroke-linejoin: round; }
#board .roll { filter: drop-shadow(0 4px 4px #6b431280); }
#board .roll .tube { stroke: #a9782f; stroke-width: 1.5; stroke-linejoin: round; }
#board .crease { fill: none; stroke: #c4933f; stroke-width: 2; stroke-linecap: round; opacity: .6; }
#board .curl { fill: #f1d899; stroke: #a9782f; stroke-width: 1.5; }
#board .hollow { fill: #c08f3e; }
#board .coil { fill: none; stroke: #8f6224; stroke-width: 1.4; stroke-linecap: round; }

/* Land: player colours stay clear but a little printed. */
#board .shape { fill-opacity: .86; stroke: #f6e8c4; stroke-width: 1.4; stroke-linejoin: round; }
#board .river { fill: none; stroke: #c4dedb; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .55; }
#board .shore { fill: none; stroke: #33220c; stroke-width: 2.5; stroke-linejoin: round; }
#board .group { fill: none; stroke: #2a1a08; stroke-width: 5; stroke-linejoin: round; }
#board .water { stroke: #33220c; stroke-width: 3.5; stroke-dasharray: 3 8; stroke-linecap: round; }
#board .highlight { fill: none; stroke: none; stroke-linejoin: round; }
#board .highlight.picked { stroke: #ffe45c; stroke-width: 7; filter: drop-shadow(0 0 5px #fff3a0); }
#board .highlight.target { stroke: #fff6c9; stroke-width: 5; stroke-dasharray: 11 6; }

/* Lettering and ornaments */
#board .seaname { font-size: 28px; font-style: italic; letter-spacing: 7px; fill: #5c5334; opacity: .7; }
#board .country { font-size: 27px; letter-spacing: 10px; fill: #7a6133; opacity: .65; }
#board .plaque .sheet { fill: #f4e7c4; stroke: #4a2f16; stroke-width: 2.5; filter: drop-shadow(2px 3px 3px #0004); }
#board .plaque .rule { fill: none; stroke: #b8903f; stroke-width: 1.2; }
#board .title { font-size: 28px; font-weight: 700; fill: #7a2617; }
#board .heading { font-size: 20px; font-weight: 700; fill: #7a2617; }
#board .legend { text-anchor: start; font-size: 16.5px; }
#board .legend.bonus { text-anchor: end; font-weight: 700; }
#board .compass .ring { fill: none; stroke: #4a3415; stroke-width: 2; }
#board .compass .thin { stroke-width: .8; }
#board .compass .dark { fill: #4a3415; }
#board .compass .major.dark { fill: #7a2617; }
#board .compass .light { fill: #f1e4c3; stroke: #4a3415; stroke-width: .8; }
#board .compass .hub { fill: #b8903f; stroke: #4a3415; }
#board .compass text { font-size: 19px; font-weight: 700; }
.sea-life .ship path { stroke: #241405; stroke-linejoin: round; }
.sea-life .ship .hull { fill: #4a2c14; }
.sea-life .ship .mast { stroke-width: 2.2; }
.sea-life .ship .yard { stroke-width: 1.6; }
.sea-life .ship .sail { fill: #f4e7c4; stroke: #4a3415; }
.sea-life .ship .trim { fill: none; stroke: #c39a52; stroke-width: 1.4; }
.sea-life .ship .port { fill: #17110b; stroke: #c39a52; stroke-width: .8; }
.sea-life .ship .flag { fill: #17110b; }
.sea-life .ship .bones { fill: none; stroke: #f4e7c4; stroke-width: 1.4; }
.sea-life .ship .skull { fill: #f4e7c4; stroke: none; }
.sea-life .ship .eyes { fill: #17110b; stroke: none; }
.sea-life .ship .wake { fill: none; stroke: #3f625c; stroke-width: 1.5; }

/* Names and army pieces */
#board .name { font-size: 17.5px; font-weight: 700; stroke: #f8ecca; stroke-width: 3.8; stroke-linejoin: round; paint-order: stroke; }
#board .chip-shadow { fill: #000; opacity: .32; pointer-events: none; }
#board .chip { stroke: #1f1305; stroke-width: 1.6; }
#board .notches { fill: none; stroke: #f8ecca; stroke-width: 3; stroke-dasharray: 4 6.6; }
#board .face { fill: #fbf3dc; stroke: #1f1305; stroke-width: .8; }
#board .armies { font-size: 16px; font-weight: 800; }
#board .pickable, #board .target { cursor: pointer; }
#board .pickable.territory:hover .shape, #board .territory:focus-visible .shape { filter: brightness(1.2); }
#board .territory:focus { outline: none; }
[hidden] { display: none !important; }

/* Headings and lettering in the display face */
h1, h2, h3, aside .tabs button, #board .title, #board .heading, #board .seaname, #board .country { font-family: var(--display); }
#board .title { font-size: 25px; }
#board .country { text-transform: uppercase; }
#board .name { font-size: 16.5px; }
#hand .ready { font-weight: 600; }

/* Language menu: a small flag, the other one drops down. */
#masthead { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
#masthead h1 { margin: 0; }
body.playing #masthead { margin: 0; }
#lang { position: relative; flex: none; }
#lang summary { display: inline-flex; padding: .2rem; list-style: none; cursor: pointer; }
#lang summary::-webkit-details-marker { display: none; }
#lang svg { display: block; border: 1px solid var(--line); border-radius: 2px; }
#lang .menu { position: absolute; z-index: 2; top: 100%; right: 0; display: grid; gap: .25rem; padding: .35rem; background: var(--paper-light); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 10px #0003; }
#lang .menu button { display: flex; align-items: center; gap: .5rem; padding: .25rem .6rem; font-size: .85rem; background: none; border-color: transparent; box-shadow: none; color: var(--ink); }
#lang .menu button[aria-pressed="true"] { border-color: var(--line); font-weight: 600; }

/* Gently moving sea: our own waves and the ship, on a layer above the board. */
.boardwrap { position: relative; }
.sea-life { position: absolute; top: 0; left: 0; overflow: hidden; pointer-events: none; will-change: transform; }
.sea-life .swell { fill: none; stroke: #5c7f79; stroke-width: 2; stroke-linecap: round; animation: swell 7s ease-in-out infinite; }
@keyframes swell {
  0%, 100% { transform: translate(-5px, 1px); opacity: .12; }
  50% { transform: translate(6px, -2px); opacity: .55; }
}
.sea-life .rocking { transform-box: fill-box; transform-origin: 50% 100%; animation: rocking 6s ease-in-out infinite; }
@keyframes rocking {
  0%, 100% { transform: rotate(-2.5deg) translateY(1px); }
  50% { transform: rotate(2.5deg) translateY(-2px); }
}
/* A dolphin or shark jumping out of the sea now and then (see board.js). */
.sea-life .animal path, .sea-life .animal circle { stroke-linejoin: round; stroke-linecap: round; }
.sea-life .dolphin .skin { fill: #4f7184; stroke: #1f2c35; }
.sea-life .shark .skin { fill: #707a80; stroke: #262d31; }
.sea-life .animal .belly { fill: #e9e4d2; }
.sea-life .animal .eye { fill: #10161a; }
.sea-life .animal .tooth { fill: #fff; stroke: #262d31; stroke-width: .3; }
.sea-life .animal .gill { fill: none; stroke: #262d31; stroke-width: .8; }
.sea-life .splash { fill: none; stroke: #3f625c; stroke-width: 1.3; opacity: 0; animation: 2s linear; }
.sea-life .splash.out { animation-name: splash-out; }
.sea-life .splash.in { animation-name: splash-in; }
.sea-life .dolphin .beast { animation: dolphin-jump 2s linear both; }
.sea-life .shark .beast { animation: shark-leap 2s ease-in-out both; }
@keyframes dolphin-jump {
  0% { transform: translate(-40px, 26px) rotate(-55deg); }
  17% { transform: translate(-29px, 4px) rotate(-45deg); }
  33% { transform: translate(-15px, -15px) rotate(-25deg); }
  50% { transform: translate(0, -21px) rotate(0deg); }
  67% { transform: translate(15px, -15px) rotate(28deg); }
  83% { transform: translate(29px, 4px) rotate(50deg); }
  100% { transform: translate(40px, 30px) rotate(62deg); }
}
@keyframes shark-leap {
  0% { transform: translate(-4px, 44px) rotate(-72deg); }
  44% { transform: translate(0, -12px) rotate(-66deg); }
  64% { transform: translate(4px, -10px) rotate(-40deg); }
  100% { transform: translate(14px, 46px) rotate(20deg); }
}
@keyframes splash-out { 0%, 6% { opacity: 0; } 15% { opacity: 1; } 40%, 100% { opacity: 0; } }
@keyframes splash-in { 0%, 72% { opacity: 0; } 85% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .sea-life .swell, .sea-life .rocking { animation: none; }
  .sea-life .swell { opacity: .35; }
}

/* Dice tumbling for a moment; the sentence about the losses waits until they lie still. */
#battle.rolling p { visibility: hidden; }
#battle.rolling .die { animation: tumble .17s linear infinite; }
#battle.rolling .die:nth-child(even) { animation-direction: reverse; }
@keyframes tumble {
  0% { transform: rotate(0) translateY(0); }
  50% { transform: rotate(18deg) translateY(-4px); }
  100% { transform: rotate(0) translateY(0); }
}

/* A conquered territory lights up twice. */
.sea-life .flash { fill: none; stroke-linejoin: round; opacity: 0; animation: flash 2s ease-in-out; }
.sea-life .flash .halo { fill: #fff6c9; fill-opacity: .08; stroke: #fff6c9; stroke-width: 12; stroke-opacity: .75; }
.sea-life .flash .ring { stroke-width: 5; }
@keyframes flash {
  0%, 50%, 100% { opacity: 0; }
  20%, 70% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sea-life .flash { animation: none; opacity: 1; }
}

/* Winner screen */
#result { width: min(44rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-sizing: border-box; padding: 1rem 1.25rem; color: var(--ink); background: var(--paper) var(--grain); border: 4px double var(--line); border-radius: 8px; box-shadow: 0 12px 40px #0008; }
#result::backdrop { background: #2f211188; }
#result h2 { margin: 0 0 .75rem; font-size: 1.6rem; text-align: center; }
#result .scroll { overflow-x: auto; }
#result th, #result td { padding: .35rem .5rem .35rem 0; vertical-align: middle; font-size: .9rem; }
#result thead th { font-size: .75rem; line-height: 1.2; vertical-align: bottom; }
#result td, #result thead th + th { text-align: center; }
#result tbody th { font-weight: 400; white-space: nowrap; }
#result tr.winner { background: #f7d65c55; }
#result .row { justify-content: center; }
#result p { min-height: 1.45em; margin: .6rem 0; text-align: center; }

/* Small screens: the map fills the screen, what you can do sits at the bottom and the
   rest is behind tabs. Same condition as SMALL in app.js. */
@media (max-width: 55.99rem), (max-height: 29.99rem) {
  /* Army pieces: the whole board is shrunk to fit, so the numbers need to be a size larger. */
  #board .notches { stroke-width: 4; stroke-dasharray: 6 9.5; }
  #board .armies { font-size: 29px; transform: translateY(3px); }
  #board .name { transform: translateY(-7px); }
  body.playing { height: 100vh; height: 100dvh; overflow: hidden; }
  body.playing main { max-width: none; height: 100%; box-sizing: border-box; padding: .35rem; }
  #started { display: flex; flex-direction: column; gap: .35rem; height: 100%; }
  .top { display: contents; }
  .statusbar { order: 0; flex-wrap: nowrap; align-items: center; }
  .statusbar h2 { font-size: 1rem; line-height: 1.2; }
  #clock { font-size: .85rem; white-space: nowrap; }
  .boardwrap, .info, #started aside { order: 1; flex: 1; min-height: 0; margin: 0; }
  #panel { order: 2; flex: none; box-sizing: border-box; height: 9.25rem; margin: 0; overflow-y: auto; }
  #views { order: 3; display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }

  body:not([data-view="map"]) .boardwrap, body:not([data-view="info"]) .info,
  body:not([data-view="log"]):not([data-view="chat"]) #started aside { display: none; }
  /* Reading and typing get the whole height. */
  body[data-view="log"] #panel, body[data-view="chat"] #panel { display: none; }

  .boardwrap { touch-action: none; border-radius: 6px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .sea-life { will-change: auto; }
  .info { overflow-y: auto; }
  #started aside { display: flex; flex-direction: column; }
  aside .tabs { display: none; }
  #log { flex: 1; height: auto; min-height: 0; margin: 0; font-size: .95rem; }
  #gamechat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  #gamechat #chat { flex: 1; }
  #gamechat #messages { flex: 1; height: auto; min-height: 3rem; font-size: .95rem; }

  /* Large enough for a finger; 16px text stops phones from zooming in on a field. */
  #panel input, #panel button, #hand button, #hand select, .info button, .info a.cta, #result a.cta, #result button, #chatform input, #chatform button { min-height: 2.6rem; font-size: 1rem; }
  #views button { min-height: 3rem; padding: .2rem; font-size: .82rem; line-height: 1.15; }
  #views button[aria-pressed="false"] { background: var(--paper-light); color: var(--wood); border-color: var(--line); box-shadow: 0 1px 2px #0002; }
  .badge { display: inline-block; min-width: 1.2rem; border-radius: .6rem; background: var(--gold); color: var(--ink); font-size: .72rem; line-height: 1.2rem; }

  .zoombuttons { position: absolute; right: .35rem; bottom: .35rem; display: grid; gap: .3rem; }
  .zoombuttons button { width: 2.6rem; height: 2.6rem; padding: 0; font-size: 1.3rem; line-height: 1; opacity: .92; }

  #battle { position: absolute; left: .35rem; top: .35rem; max-width: calc(100% - 1rem); padding: .3rem .5rem; background: var(--paper-light); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 8px #0004; }
  #battle p { margin: 0 0 .25rem; font-size: .75rem; }
  /* The fight is in the upper half: lie below it, left of the zoom buttons. */
  #battle.low { top: auto; bottom: .35rem; max-width: calc(100% - 4.8rem); }
  #battle.stale { display: none; }
  #battle .die { width: 1.7rem; height: 1.7rem; padding: .2rem; }
  #battle .die i { width: .3rem; height: .3rem; }
}

/* A phone on its side: the map left, the rest next to it. */
@media (orientation: landscape) and (max-height: 29.99rem) {
  #started { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "view status" "view panel" "view tabs"; }
  .statusbar { grid-area: status; flex-wrap: wrap; }
  .boardwrap, .info, #started aside { grid-area: view; }
  #panel { grid-area: panel; height: auto; }
  #views { grid-area: tabs; }
  body[data-view="log"] #panel, body[data-view="chat"] #panel { display: flex; }
}

/* The winner screen on a narrow screen: one block per player instead of a wide table. */
@media (max-width: 40rem) {
  #result { padding: .75rem; }
  #result table, #result tbody { display: block; }
  #result thead { display: none; }
  #result tbody tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem; padding: .35rem .4rem; border-bottom: 1px solid #ddd1b5; }
  #result tbody th { grid-column: 1 / -1; border: 0; padding: .1rem 0; }
  #result tbody td { display: flex; justify-content: space-between; gap: .5rem; border: 0; padding: 0; font-size: .8rem; }
  #result tbody td::before { content: attr(data-label); color: #75684c; text-align: left; }
}

/* Settings in the lobby */
:is(#turntime, #botlevel) button[aria-pressed="false"]:disabled { opacity: .35; }
:is(#turntime, #botlevel) button[aria-pressed="true"]:disabled { opacity: 1; }

/* The board of kaart-3 (board-net.js): the orange of the Noderunners logo, black cells, round dots on the links,
   lettered in Perfect DOS VGA 437. */
#board.net text { font-family: 'Perfect DOS VGA 437', ui-monospace, Menlo, Consolas, "Courier New", monospace; fill: #111; }
#board.net .screen { fill: #ff7a00; }
#board.net .scanline { fill: #f27300; }
#board.net .gridline { fill: none; stroke: none; }
#board.net .link { stroke: #111; stroke-width: 4; stroke-linecap: round; }
#board.net .dot { fill: #111; }
#board.net .linkwrap.lit .link { stroke: #fff; stroke-width: 6; }
#board.net .linkwrap.lit .dot { fill: #fff; }
#board.net .plate { fill: #111; }
#board.net .shape { fill-opacity: .18; stroke-width: 6; stroke-opacity: 1; stroke-linejoin: round; }
#board.net .shape.mined { fill-opacity: .7; }
#board.net .cellname { font-weight: 400; letter-spacing: 0; stroke: none; }
#board.net .cellarmies { font-size: 40px; fill: #ff7a00; }
#board.net .emblem { fill: #ff7a00; pointer-events: none; }
#board.net .highlight { fill: none; stroke: none; }
#board.net .highlight.picked { stroke: #fff; stroke-width: 6; filter: drop-shadow(0 0 6px #fff); }
#board.net .highlight.target { stroke: #fff; stroke-width: 4; stroke-dasharray: 9 7; filter: none; }
#board.net .pickable.territory:hover .shape, #board.net .territory:focus-visible .shape { fill-opacity: .5; }
#board.net .netflash { fill: none; stroke-width: 8; opacity: 0; animation: net-flash 2s ease-in-out; }
@keyframes net-flash { 0% { opacity: 0; } 12%, 60% { opacity: .95; } 100% { opacity: 0; } }
#board.net .title { font-size: 32px; fill: #111; text-anchor: start; }
#board.net .heading { font-size: 20px; fill: #111; text-anchor: start; }
#board.net .legend { font-size: 20px; fill: #111; text-anchor: start; }
#board.net .legend.bonus { text-anchor: end; }
#board.net .legendbox rect { stroke: #111; stroke-width: 2; }
@media (prefers-reduced-motion: reduce) {
  #board.net .netflash { animation: none; opacity: .8; }
}
@media (max-width: 55.99rem), (max-height: 29.99rem) {
  #board.net .cellarmies { font-size: 44px; }
}

/* ---------------------------------------------------------------------------
   Hashpower page theme: an orange screen in a black frame, set in a DOS font.
   Overrides the parchment variables above, so most of the page follows by itself;
   only the colours that were written out in full are repeated here.
   --------------------------------------------------------------------------- */
:root {
  --paper: #0d0d0d; --paper-light: #000; --ink: #ff7a00; --wood: #ff7a00; --wine: #ff7a00; --gold: #ff7a00; --line: #ff7a00;
  --dim: #b35500; --screen: #ff7a00; --black: #000;
  --text: 'Perfect DOS VGA 437', 'Courier New', monospace;
  --display: 'Perfect DOS VGA 437', 'Courier New', monospace;
  --grain: none;
}
body { background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: none; }
/* Faint CRT lines over everything; static, so cheap. */
body::after { content: ''; position: fixed; inset: 0; z-index: 50; pointer-events: none; background: repeating-linear-gradient(#0000 0 3px, #0000002e 3px 4px); }
::selection { background: var(--screen); color: var(--black); }

h1, h2, h3 { font-weight: 400; text-transform: uppercase; letter-spacing: .04em; }
h1 { font-size: 2rem; line-height: 1.1; }
h1::before { content: '> '; }
h1::after { content: '_'; animation: cursor 1.1s steps(1) infinite; }
@keyframes cursor { 50% { opacity: 0; } }
h2 { font-size: 1.2rem; }
h2::before { content: '# '; color: var(--dim); }
body.playing .statusbar h2::before { content: ''; }
#rules h3 { font-size: 1rem; }

input, button, a.cta { border-width: 2px; border-radius: 0; }
input { background: var(--black); color: var(--ink); border-color: var(--line); caret-color: var(--ink); }
input::placeholder { color: var(--dim); opacity: 1; }
input:focus-visible, button:focus-visible, a.cta:focus-visible, summary:focus-visible { outline: 2px dashed #fff; outline-offset: 2px; }
button, a.cta { background: var(--screen); color: var(--black); border-color: var(--screen); box-shadow: none; text-transform: uppercase; letter-spacing: .03em; }
button:hover:not(:disabled), a.cta:hover { filter: none; background: var(--black); color: var(--screen); }
button.quiet, aside .tabs button[aria-pressed="false"], #views button[aria-pressed="false"] { background: var(--black); color: var(--ink); border-color: var(--line); box-shadow: none; }
button.quiet:hover:not(:disabled), aside .tabs button[aria-pressed="false"]:hover, #views button[aria-pressed="false"]:hover { background: var(--screen); color: var(--black); }
button:disabled { opacity: .4; }
#sound, #sound:hover { background: none; text-transform: none; }
.swatch { border-radius: 50%; }
.swatch[aria-pressed="true"] { border-color: #fff; }
#lang .menu button { background: none; color: var(--ink); text-transform: none; }
#lang .menu button:hover { background: var(--screen); color: var(--black); }
#lang .menu { background: var(--black); border: 2px solid var(--line); border-radius: 0; box-shadow: none; }
#lang svg { border: 2px solid var(--line); border-radius: 0; }
#muted button, #hand .card { text-transform: none; letter-spacing: 0; }

.notice { background: var(--screen); color: var(--black); border-radius: 0; }
body.playing .notice { box-shadow: 0 0 0 3px var(--black), 0 0 0 5px var(--screen); }
form small, li .tags, .tags, #result tbody td::before { color: var(--dim); font-size: 1rem; }
li, th, td { border-bottom: 1px dashed #5c2d00; }
#log li.turn { border-top: 1px dashed var(--dim); }
#messages li, #log li { border-bottom: 0; }

#panel, #messages, #log { background: var(--black); border: 3px double var(--line); border-radius: 0; box-shadow: none; }
#chat, #log, #messages, #rules, .info, aside, #hand .hint, #battle p, #chatform input, #chatform button { font-size: 1rem; }
#log, #messages { line-height: 1.3; }
.info th { font-size: 1rem; }
#unread { background: var(--screen); color: var(--black); border-radius: 0; }
.badge { background: var(--screen); color: var(--black); border-radius: 0; }
#chaterror { color: #ff6a5c; }
.boardwrap { border-radius: 0; }

/* Cards by symbol: Node green, Hash amber, Key cyan (the layer colours of the map). */
#hand .card { color: var(--black); border: 2px solid var(--black); border-radius: 0; box-shadow: none; font-weight: 400; }
#hand .card.schild { background: #35e07a; }
#hand .card.zwaard { background: #ffb000; }
#hand .card.kroon { background: #3fd7e8; }
#hand .card.heraut { background: linear-gradient(100deg, #ffb000 0 33%, #3fd7e8 33% 66%, #35e07a 66%); }
#hand .card:hover:not(:disabled) { color: var(--black); filter: brightness(1.15); }
#hand .card[aria-pressed="true"] { outline: 3px solid #fff; }
#hand .ready { font-weight: 400; }

/* Dice: square, one orange, one black with an orange edge. */
.die { border-radius: 0; box-shadow: none; }
.die i { border-radius: 0; }
.die.attacker { background: var(--screen); }
.die.attacker .pip { background: var(--black); }
.die.defender { background: var(--black); border: 2px solid var(--line); }
.die.defender .pip { background: var(--ink); }
#battle { background: var(--black); border: 2px solid var(--line); border-radius: 0; box-shadow: none; }

/* The winner screen */
#result { background: var(--black); color: var(--ink); border: 4px double var(--line); border-radius: 0; box-shadow: 0 0 0 100vmax #000c; }
#result::backdrop { background: #000c; }
#result tr.winner { background: #ff7a0033; }
#result h2::before { content: ''; }

/* The Dutch map keeps its own parchment colours and fonts. */
#board:not(.net) text { fill: #2f2111; font-family: 'Inter', system-ui, sans-serif; }
#board:not(.net) :is(.title, .heading, .seaname, .country) { font-family: 'Fraunces', Georgia, serif; }
#board:not(.net) :is(.title, .heading) { fill: #7a2617; }

@media (prefers-reduced-motion: reduce) { h1::after { animation: none; } }

/* Dark switch: the same board on a black screen, with orange lines. */
#masthead #theme, .clockbar #theme { display: inline-flex; padding: .2rem; border: 0; background: none; box-shadow: none; color: var(--ink); opacity: .65; }
#theme:hover:not(:disabled), #theme:focus-visible, #theme[aria-pressed="true"] { background: none; color: var(--ink); opacity: 1; filter: none; }
#theme path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
#theme[aria-pressed="true"] path { fill: currentColor; }
#masthead #theme { margin-left: auto; }
body.dark .boardwrap { outline: 2px solid #5c2d00; outline-offset: -2px; }
body.dark #board.net text { fill: #ff7a00; }
body.dark #board.net .screen { fill: #0b0b0b; }
body.dark #board.net .scanline { fill: #111; }
body.dark #board.net .link { stroke: #ff7a00; stroke-width: 3; }
body.dark #board.net .dot { fill: #ff7a00; }
body.dark #board.net .plate { fill: #000; }
body.dark #board.net .shape { fill-opacity: .1; stroke-width: 5; }
body.dark #board.net .shape.mined { fill-opacity: .55; }
body.dark #board.net :is(.title, .heading, .legend) { fill: #ff7a00; }
body.dark #board.net .legendbox rect { stroke: #ff7a00; }

/* Blocks behind each group of cells: filled, with a thick rounded edge of the same colour. */
#board.net .region { fill: var(--layer); stroke: var(--layer); stroke-width: 22; stroke-linejoin: round; opacity: .38; }
body.dark #board.net .region { opacity: .14; }

/* The lightning bolt that strikes now and then (see bolt() in board-net.js). */
#board.net .bolt { fill: #fff; stroke: #111; stroke-width: 4; stroke-linejoin: round; opacity: 0; animation: bolt-strike 1.8s linear both; filter: drop-shadow(0 0 8px #fff3a0); }
@keyframes bolt-strike {
  0%, 100% { opacity: 0; }
  6%, 18%, 30%, 38% { opacity: 1; }
  12%, 24% { opacity: .15; }
  70% { opacity: .9; }
}
body.dark #board.net .bolt { fill: #ffe45c; stroke: #fff; stroke-width: 2; }
