html, body { min-height: 100%; }
body { overscroll-behavior: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }

/* ---------- kop ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0 18px; min-height: 84px; }
.top h1 { margin: 0; font-size: 30px; font-weight: 800; flex: 1; line-height: 1.1; }
.round { width: 56px; min-width: 56px; padding: 0; border-radius: 50%; }
.tvchip { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 14px; font-size: 17px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #b9c0ca; border: 2px solid var(--ink); }
.dot.on { background: #3ccf6e; }
.band { margin: 0 -16px 18px; padding: 0 16px; background: var(--accent); border-bottom: var(--line) solid var(--ink); color: #fff; }
.band .top h1 { text-shadow: 0 2px 0 rgba(0,0,0,.25); }

/* ---------- koppelen ---------- */
.pair { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6vh; }
.wordmark { font-size: clamp(44px, 9vw, 72px); font-weight: 800; margin: 0; letter-spacing: -1px; }
.wordmark span { display: inline-block; }
.pair p { color: var(--muted); font-size: 20px; margin: 6px 0 26px; }
.digits { display: flex; gap: 12px; margin-bottom: 26px; }
.digit { width: 66px; height: 82px; border: var(--line) solid var(--ink); border-radius: 16px; background: #fff; display: grid; place-items: center; font-size: 46px; font-weight: 800; box-shadow: var(--shadow); }
.digit.cur { background: #fff6c9; }
.pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; }
.pad .btn { height: 76px; font-size: 32px; }
.err { color: var(--danger); min-height: 28px; margin-top: 14px; }

/* ---------- kaarten ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; background: #fff; border: var(--line) solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-decoration: none; color: var(--ink); transition: transform .06s, box-shadow .06s; }
.card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.card .pic { aspect-ratio: 4 / 3; display: grid; place-items: center; }
.card .pic img { width: 92%; height: 92%; object-fit: contain; }
.card .name { padding: 8px 12px 10px; font-weight: 800; font-size: 20px; border-top: var(--line) solid var(--ink); background: #fff; }
.card .badge { position: absolute; top: 8px; right: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 99px; font-size: 13px; padding: 2px 9px; }
.card.theme .pic { background: var(--c); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 8px; }
.actions .btn { flex: 1 1 240px; }
.lead { color: var(--muted); margin: -6px 0 18px; }

/* ---------- kleuren ---------- */
body.coloring { overflow: hidden; }
.paint { display: grid; height: 100dvh; max-height: 100dvh; grid-template-rows: auto 1fr auto; gap: 10px; padding-bottom: 10px; }
.paint .top { padding: 10px 0 0; min-height: 0; }
.paint .top h1 { font-size: 24px; }
.stagebox { min-height: 0; display: grid; place-items: center; }
.stagebox canvas { max-width: 100%; max-height: 100%; aspect-ratio: 4 / 3; background: #fff; border: var(--line) solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); touch-action: none; }
.tools { display: flex; flex-direction: column; gap: 10px; }
.toolrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tool { width: 62px; height: 58px; padding: 0; border-radius: 16px; }
.tool.on { background: #fff6c9; transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.tool svg { width: 32px; height: 32px; }
.sizes { display: flex; gap: 8px; }
.size { width: 48px; height: 48px; padding: 0; border-radius: 14px; }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.size.on { background: #fff6c9; }
.palette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }
.sw { aspect-ratio: 1; border: var(--line) solid var(--ink); border-radius: 50%; cursor: pointer; padding: 0; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; }
.sw.on { transform: scale(1.18); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--ink); }
@media (min-width: 820px) and (min-aspect-ratio: 5/4) {
  .paint { grid-template-columns: 1fr 350px; grid-template-rows: auto 1fr; column-gap: 20px; }
  .paint .top { grid-column: 1 / 3; }
  .tools { justify-content: center; }
  .palette { grid-template-columns: repeat(5, 1fr); gap: 10px; }
}

/* ---------- vel (dialoog) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20, 30, 50, .45); display: grid; place-items: end center; }
@media (min-width: 700px) { .sheet { place-items: center; } }
.sheet-card { width: min(640px, 100%); max-height: 94dvh; overflow: auto; background: var(--bg); border: var(--line) solid var(--ink); border-radius: 28px 28px 0 0; box-shadow: 0 -5px 0 var(--ink); padding: 22px 20px 26px; animation: up .3s cubic-bezier(.3, 1.3, .5, 1); }
@media (min-width: 700px) { .sheet-card { border-radius: 28px; box-shadow: var(--shadow); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0 0 6px; font-size: 28px; }
.sheet p { margin: 0 0 14px; color: var(--muted); }
.preview { width: 100%; aspect-ratio: 4 / 3; background: #fff; border: var(--line) solid var(--ink); border-radius: 20px; margin: 6px 0 16px; display: block; }
.field { width: 100%; font: inherit; font-size: 24px; font-weight: 800; padding: 12px 16px; border: var(--line) solid var(--ink); border-radius: 16px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chips .btn { min-height: 44px; font-size: 17px; padding: 4px 14px; box-shadow: 0 3px 0 var(--ink); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .btn { flex: 1 1 200px; }
.big { min-height: 70px; font-size: 24px; }

/* ---------- scannen ---------- */
.shot { position: relative; width: 100%; touch-action: none; border: var(--line) solid var(--ink); border-radius: 20px; overflow: hidden; background: #222; }
.shot canvas { display: block; width: 100%; }
.handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 4px solid #fff; background: rgba(46, 158, 79, .85); box-shadow: 0 0 0 3px var(--ink); touch-action: none; }
.tips { margin: 0 0 18px; padding-left: 22px; color: var(--muted); }
.found { display: flex; align-items: center; gap: 14px; background: #fff; border: var(--line) solid var(--ink); border-radius: 18px; padding: 8px 14px; margin: 14px 0; }
.found img { width: 90px; aspect-ratio: 4 / 3; object-fit: contain; }

/* ---------- TV beheren ---------- */
.mine { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.mine .card .pic img { width: 90%; }
.del { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; }
.del svg { width: 22px; height: 22px; }
.themechips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.themechips .btn { min-height: 46px; font-size: 17px; padding: 4px 14px; }
.themechips .btn.on { background: var(--c); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: #fff; border: var(--line) dashed var(--ink); border-radius: 20px; }
h2.sec { font-size: 22px; margin: 26px 0 12px; }

.note { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 16px; font-size: 18px; max-width: 90vw; }
.spin { width: 56px; height: 56px; border: 6px solid #fff; border-top-color: var(--accent); border-radius: 50%; animation: sp 1s linear infinite; margin: 30px auto; box-shadow: 0 0 0 3px var(--ink); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- TV-acties ---------- */
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.act { flex-direction: column; min-height: 104px; gap: 6px; font-size: 18px; border-radius: 22px; }
.act svg { width: 40px; height: 40px; }
.act.on { background: #fff6c9; }
.toggles { display: flex; flex-direction: column; gap: 10px; }
.tog { display: flex; align-items: center; gap: 14px; background: #fff; border: var(--line) solid var(--ink); border-radius: 18px; padding: 12px 16px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog i { flex: none; width: 60px; height: 34px; border-radius: 99px; border: var(--line) solid var(--ink); background: #cfd6df; position: relative; transition: background .15s; }
.tog i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .15s; }
.tog input:checked + i { background: var(--accent); }
.tog input:checked + i::after { transform: translateX(26px); }
.tog input:focus-visible + i { outline: 4px solid #3b82f6; outline-offset: 3px; }
.namerow { display: flex; gap: 10px; }
.namerow .field { flex: 1; min-width: 0; font-size: 20px; }

/* eigen tekeningen */
.cutprev { border: var(--line) solid var(--ink); border-radius: 20px; overflow: hidden; background-color: #fff;
  background-image: linear-gradient(45deg, #e9eef3 25%, transparent 25%, transparent 75%, #e9eef3 75%), linear-gradient(45deg, #e9eef3 25%, transparent 25%, transparent 75%, #e9eef3 75%);
  background-size: 28px 28px; background-position: 0 0, 14px 14px; }
.cutprev canvas { display: block; width: 100%; }
.slide { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; color: var(--muted); font-weight: 700; }
.slide input { flex: 1; min-width: 0; height: 36px; accent-color: var(--accent); }
.kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kinds .kind { flex-direction: column; min-height: 0; padding: 6px 6px 8px; gap: 2px; }
.kinds .kind img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.kinds .kind.on { background: var(--accent); color: #fff; }
.kinds.facing { grid-template-columns: 1fr 1fr; }
.kinds.facing .kind { flex-direction: row; justify-content: center; padding: 14px 10px; font-size: 1.15rem; }

.edit { position: absolute; top: 6px; left: 6px; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.editdlg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.editdlg .box { background: #fff; border: var(--line) solid var(--ink); border-radius: 24px; padding: 18px; width: min(520px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 12px; }
.editdlg #epic { width: 140px; max-height: 140px; object-fit: contain; justify-self: center; }
.editdlg .lbl { font-weight: 800; }

.bgpick .hint { margin: 8px 0 12px; color: var(--muted); font-size: 18px; }
.bgpick .themechips { display: flex; flex-wrap: wrap; gap: 8px; }

.hidemin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; font-weight: 800; }
.hidemin .btn { min-height: 44px; padding: 6px 14px; }

.hidemin { align-items: center; margin-bottom: 8px; }
.hidemin > span { font-weight: 800; flex-basis: 100%; }
.hidemin[hidden] { display: none; }
