:root {
  color-scheme: light;
  --paper: #f2f5f4;
  --surface: #fff;
  --ink: #152722;
  --muted: #465b54;
  --line: #d4dfda;
  --accent: #145b48;
  --accent-light: #e4f4ec;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 76rem; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
header { margin-bottom: 1.75rem; }
.brand { margin: 0 0 .5rem; color: var(--accent); font-weight: 750; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -.045em; }
.intro { color: var(--muted); max-width: 38rem; line-height: 1.5; margin: .85rem 0 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { padding: clamp(.8rem, 2.5vw, 1.5rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
h2 { margin: 0 0 1rem; font-size: 1.25rem; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .9rem; }
th, td { border: 1px solid var(--line); padding: .55rem .3rem; text-align: center; overflow-wrap: anywhere; }
th { background: var(--accent-light); }
tr > :first-child { width: 2rem; }
.diagonal { background: var(--paper); color: var(--muted); }
#flasks { display: grid; gap: .55rem; }
.flask { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: .65rem; padding: .55rem .65rem; }
label { font-weight: 700; }
.color { justify-self: end; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.color::before { content: ''; display: inline-block; vertical-align: -.05em; width: .75em; height: .75em; border: 1px solid #778980; border-radius: 50%; margin-right: .35em; }
.color[data-color="blue"]::before { background: #82c6f2; }
.color[data-color="yellow"]::before { background: #f1d16d; }
select, button { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: .45rem; background-color: var(--surface); min-height: 2.75rem; }
select { grid-column: 1 / -1; width: 100%; padding: .4rem 1.6rem .4rem .55rem; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-size: 5px 5px; background-position: calc(100% - 14px) center, calc(100% - 9px) center; background-repeat: no-repeat; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
button { padding: .4rem .8rem; cursor: pointer; font-weight: 650; }
#check { color: white; background: var(--accent); border-color: var(--accent); }
#check:disabled { color: var(--muted); background: var(--paper); border-color: var(--line); cursor: default; }
button:not(:disabled):hover { box-shadow: inset 0 0 0 1px currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#result { margin: .75rem 0 0; line-height: 1.4; }
#result:empty { margin: 0; }
#result[data-state="solved"] { color: var(--accent); font-weight: 700; }
details { margin-top: 1rem; color: var(--muted); line-height: 1.5; }
details p { max-width: 48rem; }
summary { cursor: pointer; }

@media (max-width: 56rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 26rem) {
  th, td { padding-inline: .15rem; font-size: .875rem; }
}
