/* The Silver Peacock - palette from coolors.co: 0d1b2a 1b263b 415a77 778da9 e0e1dd */
:root {
  --bg: #0d1b2a; --panel: #1b263b; --panel2: #415a77; --accent: #778da9; --light: #e0e1dd;
  --good: #7fd6a8; --bad: #f08a7a; --muted: #8394ab;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(135deg, var(--bg), var(--panel)) fixed;
  color: var(--light); font-family: "Segoe UI", system-ui, sans-serif; line-height: 1.5;
}
main { flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: 18px 24px; }
footer {
  text-align: center; font-size: .85rem; color: var(--accent); padding: 10px;
  background: var(--bg); border-top: 1px solid var(--panel2);
}
h1, h2 { font-family: Georgia, serif; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h3 { margin: 0 0 6px; }
.accent { color: var(--accent); font-size: .8rem; letter-spacing: .08em; }
.muted { color: var(--muted); }
p { margin: 6px 0; }

.card { background: var(--panel); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.btn {
  display: inline-block; background: var(--accent); color: var(--bg); border: 0; border-radius: 5px;
  padding: 9px 16px; font: 700 1rem inherit; font-family: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #9db0c8; }
.btn.ghost { background: var(--panel2); color: var(--light); }
.btn.ghost:hover { background: #52709a; }
.flash { background: var(--panel2); padding: 10px 14px; border-radius: 6px; }

input, textarea {
  width: 100%; border: 0; border-radius: 5px; padding: 9px; font: inherit;
  background: var(--light); color: var(--bg);
}
.form { display: flex; flex-direction: column; gap: 12px; width: min(460px, 100%); }
.form.wide { width: 100%; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: .95rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
.form label.check input { width: auto; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-top: 6vh; }
.hero p { max-width: 640px; }
.hero .form { text-align: left; }
.sub { font-family: Georgia, serif; font-style: italic; font-size: 1.2rem; margin: 0; }

.bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bar h2 { flex: 1; }
.points { font-weight: 700; }
.steps { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; }

.board { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; align-items: start; }
.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.case { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin: 0; }
.case .btn { grid-column: 1 / -1; text-align: center; }
.num { font: 700 2.2rem Georgia, serif; color: var(--accent); }
.tag { color: var(--accent); font-size: .9rem; }
.solved .tag { color: var(--good); }
.locked .tag { color: var(--muted); }

.casegrid { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.task { background: var(--panel2); border: 2px solid var(--accent); }
#editor { font-family: Consolas, "Courier New", monospace; font-size: 1.05rem; background: #08111c; color: var(--light); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.row .right { margin-left: auto; }
.msg { font-weight: 600; min-height: 1.5em; color: var(--muted); }
.msg.ok { color: var(--good); }
.msg.miss, .msg.error { color: var(--bad); }
.msg.warn, .msg.hint { color: var(--accent); }

.chips { position: sticky; top: 12px; }
.chipgrid { display: grid; gap: 5px; margin-bottom: 12px; }
.chipgrid.three { grid-template-columns: repeat(3, 1fr); }
.chipgrid.two { grid-template-columns: repeat(2, 1fr); }
.chip {
  background: var(--panel2); color: var(--light); border: 0; border-radius: 4px; padding: 6px 4px;
  font: 700 .78rem inherit; font-family: inherit; cursor: pointer;
}
.chip:hover { background: var(--accent); color: var(--bg); }

.tablewrap { overflow: auto; max-height: 340px; background: var(--light); color: var(--bg); border-radius: 6px; margin-bottom: 12px; }
#result:empty { display: none; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th { background: var(--accent); color: var(--bg); text-align: left; padding: 6px 10px; position: sticky; top: 0; }
td { padding: 5px 10px; border-bottom: 1px solid #c4c8cc; }
tbody tr:nth-child(even) { background: #d2d4d0; }

@media (max-width: 900px) {
  .board, .casegrid, .cases { grid-template-columns: 1fr; }
  .chips { position: static; }
}
