:root {
  --bg: #f4f1ea; --card: #fff; --ink: #1d2433; --muted: #5d6677; --line: #d9d4c7;
  --felt: #1f6b47; --felt2: #185a3b; --accent: #1f6b47; --red: #c4232f; --hl: #ffd75e; --good: #1f8a4c; --bad: #c4232f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.red { color: var(--red); }
header { background: var(--felt2); color: #fff; padding: 10px 16px 0; }
header h1 { margin: 0 0 8px; font-size: 1.35rem; text-align: center; }
header h1 .red { color: #ff8a8a; }
nav { display: flex; justify-content: center; gap: 4px; }
nav button { background: transparent; color: #e5f2ea; border: 0; padding: 10px 18px; font: inherit; font-weight: 600; border-radius: 10px 10px 0 0; cursor: pointer; }
nav button.active { background: var(--bg); color: var(--ink); }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.tab { display: none; } .tab.active { display: block; }
button.btn, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.light { background: #e6e1d4; color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }

/* Lessen */
.lesson-item { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; cursor: pointer; }
.lesson-item:hover { border-color: var(--accent); }
.lesson-item .done { color: var(--good); font-weight: 700; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.panel h2 { margin-top: 0; }
.example { background: #f1f6f2; border-left: 4px solid var(--accent); padding: 8px 12px; margin: 10px 0; border-radius: 4px; }
table.pts, table.sys { border-collapse: collapse; margin: 8px 0; }
table.pts td, table.sys td, table.sys th { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.quiz { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.q { margin-bottom: 14px; }
.q .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.q .opts button { background: #eef0f3; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
.q .opts button.ok { background: #d8f0e1; border-color: var(--good); }
.q .opts button.wrong { background: #f8dcdc; border-color: var(--bad); }
.fb { margin-top: 4px; font-size: .95rem; }
.fb.ok { color: var(--good); } .fb.wrong { color: var(--bad); }
.navrow { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Oefenen */
.drillmenu { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.drillmenu button { background: #e6e1d4; border: 0; border-radius: 20px; padding: 7px 14px; font: inherit; cursor: pointer; }
.drillmenu button.active { background: var(--accent); color: #fff; }
.drillhand { font-size: 1.3rem; margin: 10px 0; }
.drill input { font: inherit; width: 80px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.choices button { min-width: 56px; padding: 8px 10px; font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.choices button.ok { background: #d8f0e1; border-color: var(--good); }
.choices button.wrong { background: #f8dcdc; border-color: var(--bad); }

/* Hand weergave */
.hand .row { white-space: nowrap; line-height: 1.7; }
.hand .sym { display: inline-block; width: 1.3em; font-weight: 700; }
.hand .c { display: inline-block; min-width: 1.5em; text-align: center; padding: 0 2px; margin: 0 1px; border-radius: 5px; font-weight: 600; }
.hand .c.play { background: var(--hl); color: #000; cursor: pointer; box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.hand .c.tip { outline: 3px solid #ff4d4d; }
.hand .r2 { color: var(--red); }

/* Speltafel */
.infobar { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .95rem; color: var(--muted); margin-bottom: 8px; }
.infobar b { color: var(--ink); }
.table { display: grid; grid-template-columns: 1fr 1.4fr 1fr; grid-template-areas: ". n ." "w c e" ". s ."; gap: 8px; background: var(--felt); border-radius: 14px; padding: 10px; color: #fff; }
.seat { background: rgba(0,0,0,.15); border-radius: 10px; padding: 6px 10px; min-height: 60px; border: 2px solid transparent; }
.seat.turn { border-color: var(--hl); }
.seat .name { font-size: .85rem; opacity: .9; margin-bottom: 2px; }
.seat .name b { font-size: 1rem; }
.seat .hand { font-size: 1.05rem; }
.seat .hand .r2 { color: #ffb3b3; }
.seat .hand .c.play.r2, .seat .hand .c.play { color: #000; }
.seat .hand .c.play.r2 { color: var(--red); }
.seat.n { grid-area: n; } .seat.s { grid-area: s; } .seat.e { grid-area: e; } .seat.w { grid-area: w; }
.seat.s .hand { font-size: 1.25rem; }
.backs { opacity: .8; font-size: .9rem; }
.center { grid-area: c; background: var(--felt2); border-radius: 10px; padding: 8px; min-height: 170px; display: flex; flex-direction: column; justify-content: center; }
.trick { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto auto; text-align: center; gap: 4px; }
.pc { display: inline-block; background: #fff; color: #000; border-radius: 6px; padding: 4px 6px; min-width: 42px; font-weight: 700; font-size: 1.15rem; box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.pc.r2 { color: var(--red); }
.pc.win { outline: 3px solid var(--hl); }
.t0 { grid-column: 2; grid-row: 1; } .t1 { grid-column: 3; grid-row: 2; } .t2 { grid-column: 2; grid-row: 3; } .t3 { grid-column: 1; grid-row: 2; }
.auction { width: 100%; border-collapse: collapse; font-size: .95rem; }
.auction th { font-weight: 600; opacity: .8; padding: 2px; }
.auction td { text-align: center; padding: 2px; }
.auction td.me { color: var(--hl); }
.ctr { text-align: center; font-size: .9rem; margin-top: 6px; opacity: .9; }

#controls { margin: 12px 0; }
.bidbox { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-width: 420px; }
.bidbox button, .calls button { font: inherit; font-weight: 700; padding: 7px 0; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.bidbox button:disabled { opacity: .25; cursor: default; }
.bidbox button.r2 { color: var(--red); }
.calls { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; max-width: 420px; }
.calls button { flex: 1; padding: 8px 10px; }
.calls button.pass { background: #dff1e6; }
.calls button.x { background: #f8dcdc; }
.calls button.tip { background: var(--hl); }
.calls button:disabled { opacity: .3; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.msg.tipmsg { border-color: #e6b800; background: #fffbe8; }
.explain { font-size: .95rem; }
.explain .line { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.explain .line b { display: inline-block; min-width: 4.5em; }
.result h3 { margin: 0 0 6px; }
.result ul { margin: 6px 0; padding-left: 20px; }
.options { margin-top: 18px; font-size: .92rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 10px; }
  .table { grid-template-columns: 1fr 1fr; grid-template-areas: "w e" "n n" "c c" "s s"; }
  .seat { min-height: 0; }
  .center { min-height: 150px; }
  nav button { padding: 9px 12px; }
}
.muted { color: var(--muted); }
