:root {
  font-family: system-ui, sans-serif;
  color: #232042;
  background: #f7f4ee;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 55rem; margin: auto; padding: clamp(.65rem, 2vw, 1rem); }
h1 { font-size: clamp(1.25rem, 4vw, 1.65rem); margin: .25rem 0 .5rem; letter-spacing: -.03em; }
h2, h3 { margin: 0 0 .5rem; }
p { line-height: 1.55; }
a { color: #5434ae; }
:focus-visible { outline: 3px solid #7d3dc3; outline-offset: 4px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.game-card, .panel { border: 2px solid #232042; border-radius: 1.25rem; box-shadow: 5px 5px 0 #232042; padding: clamp(1rem, 4vw, 2rem); }
.game-card { background: #e7d9ff; color: inherit; text-decoration: none; max-width: 25rem; }
.game-card:hover { background: #ddc9ff; }
.icon { display: block; font-size: 2rem; margin-bottom: .75rem; }
.play { font-weight: 750; }
.panel { background: #fff; }
.panel > p:first-child { margin-top: 0; }
.settings, .actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.settings { margin-bottom: 1.25rem; }
label { display: grid; gap: .35rem; font-weight: 650; }
select, button { font: inherit; color: inherit; min-height: 48px; border: 2px solid #232042; border-radius: .7rem; padding: .5rem .8rem; }
select { background: #f7f4ee; }
button { background: #5434ae; color: white; font-weight: 750; cursor: pointer; touch-action: manipulation; }
button:hover { filter: brightness(.9); }
.secondary { background: #ffe893; color: #232042; }
.quiet { background: transparent; color: #5434ae; border-color: transparent; margin-top: .3rem; }
.round-info { display: flex; justify-content: space-between; gap: 1rem; font-weight: 750; }
#round .actions > button { flex: 1; }
#word { font-size: clamp(2rem, 9vw, 4.7rem); font-weight: 850; text-align: center; line-height: 1.06; margin: .55em 0; overflow-wrap: anywhere; }
@media (orientation: landscape) and (max-height: 520px) {
  main:has(#round:not([hidden])) { padding: .85rem; }
  main:has(#round:not([hidden])) h1 { display: none; }
  #round { padding: .85rem; margin-top: .4rem; }
  #word { font-size: clamp(2rem, 13vh, 4rem); margin: .22em 0; }
}

.game-card { max-width: none; display: flex; flex-direction: column; }
.game-card p { margin: 0 0 1rem; }
.game-card .play { margin-top: auto; }
.game-card:nth-child(3n+2) { background: #ffe893; }
.game-card:nth-child(3n) { background: #c9efdc; }
.game-card:hover { filter: brightness(.96); }
#board { margin: .75rem 0 1rem; }
#status { font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; max-width: 25rem; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 20rem; }
.tiles > button, .robot-cell { min-width: 0; padding: 0; aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(1.35rem, 6vw, 2.5rem); }
.tiles > button:disabled { cursor: default; }
.tiles > button.matched { background: #c9efdc; color: #232042; }
.tiles > button.lit { background: #ffe893; color: #232042; outline: 3px solid #232042; outline-offset: -5px; }
.fireflies > button { background: #232042; }
.fireflies > button.active { background: #5434ae; }
.robot-cell { border: 1px solid #d7cfea; border-radius: .5rem; background: #f7f4ee; }
.robot-cell.wall { background: #232042; }
.robot-controls { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.robot-queue { overflow-wrap: anywhere; }

.panel { padding: clamp(.65rem, 2vw, 1rem); }
.panel p { margin-block: .35rem .6rem; }
.connect-size { width: fit-content; margin-bottom: .5rem; }
.connect-size select { min-height: 36px; padding: .25rem .5rem; }
.connect-rack { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); width: 100%; max-width: 24rem; background: #1945a4; padding: .25rem; border-radius: .65rem; }
.connect-rack > button { display: grid; justify-items: center; gap: .18rem; min-width: 0; padding: .2rem .13rem; border: 2px solid transparent; border-radius: .4rem; background: transparent; }
.connect-rack > button:hover, .connect-rack > button.selected { background: #305ab5; border-color: #d8e5ff; }
.connect-disc { display: grid; place-items: center; width: 100%; aspect-ratio: 1; background: #112954; border-radius: 50%; font-size: clamp(.65rem, 2.5vw, 1.1rem); }
.connect-disc.red { background: #c91f37; color: white; }
.connect-disc.yellow { background: #ffd649; color: #302605; }
.connect-disc.winning { outline: 2px solid white; outline-offset: -3px; }
