:root {
  --bg: #f7efe6;
  --card: rgba(255, 255, 255, 0.82);
  --text: #2b1d1a;
  --muted: #84706a;
  --border: #ecdfd4;
  --accent: #c8553d;
  --accent-hover: #b0452f;
  --accent-soft: #fbe9e2;
  --plum: #5b2a4c;
  --plum-2: #8a3b64;
  --forest: #2f5d4a;
  --forest-2: #4f8a68;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(80, 40, 20, .04), 0 12px 32px -12px rgba(80, 40, 20, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60vw 50vh at 0% 0%, #f8d9c8 0%, transparent 70%),
    radial-gradient(55vw 45vh at 100% 15%, #efd3e0 0%, transparent 70%),
    radial-gradient(70vw 50vh at 50% 110%, #dfe8d6 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

main {
  max-width: 500px;
  margin: 0 auto;
  padding: 48px 18px 40px;
}

svg { width: 1em; height: 1em; flex-shrink: 0; }

/* Kop */
header { text-align: center; margin-bottom: 28px; }
.mark {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  font-size: 20px;
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.sub { margin: 10px auto 0; max-width: 32ch; color: var(--muted); }

h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
}

.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* Login */
.login { text-align: center; }
.lock {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  margin-bottom: 10px;
}

/* Invoer */
textarea, input[type="password"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdfb;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
input[type="password"] { margin-bottom: 12px; text-align: center; }
textarea::placeholder, input::placeholder { color: #b5a39c; }
textarea:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Binnen/buiten schakelaar */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 12px 0 14px;
  background: #f3e8de;
  border-radius: 14px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: background .2s, color .2s, box-shadow .2s;
}
.segmented svg { font-size: 1.1rem; }
.segmented input:checked + span {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(80, 40, 20, .1);
}
.segmented input[value="binnen"]:checked + span svg { color: var(--plum-2); }
.segmented input[value="buiten"]:checked + span svg { color: var(--forest-2); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Knoppen */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .2s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(200, 85, 61, .55);
}
.primary:hover { background: var(--accent-hover); }
.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.secondary:hover { border-color: #d9c6b8; }
.link {
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: .85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.msg { min-height: 1.4em; margin: 10px 0 0; font-size: .9rem; color: var(--forest); text-align: center; }
.msg.error { color: #b42318; }
.msg:empty { min-height: 0; margin: 0; }

/* Kies-tegels */
.pick-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 18px 16px;
  min-height: 140px;
  color: #fff;
  text-align: left;
  border-radius: 18px;
}
.pick::after {
  /* zachte glans */
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  transition: transform .35s ease;
}
.pick:hover::after { transform: scale(1.25); }
.pick:hover { transform: translateY(-2px); }
.pick:active { transform: scale(.98); }
.pick.binnen {
  background: linear-gradient(145deg, var(--plum-2), var(--plum));
  box-shadow: 0 12px 24px -12px rgba(91, 42, 76, .7);
}
.pick.buiten {
  background: linear-gradient(145deg, var(--forest-2), var(--forest));
  box-shadow: 0 12px 24px -12px rgba(47, 93, 74, .7);
}
.pick-icon {
  font-size: 26px;
  margin-bottom: auto;
  opacity: .95;
}
.pick-title {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.1;
}
.pick small { font-size: .85rem; opacity: .8; }

/* Resultaat */
.result { margin-top: 18px; }
.result.hidden { display: none; }

.ticket {
  position: relative;
  padding: 26px 22px 24px;
  margin-bottom: 12px;
  text-align: center;
  background: #fffaf5;
  border: 1px dashed #e2c9b8;
  border-radius: 18px;
}
/* uitsparingen zoals bij een kaartje */
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px; height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fbf5ef;
  border: 1px dashed #e2c9b8;
}
.ticket::before { left: -10px; clip-path: inset(0 0 0 50%); }
.ticket::after { right: -10px; clip-path: inset(0 50% 0 0); }

.ticket.binnen { --tone: var(--plum-2); }
.ticket.buiten { --tone: var(--forest-2); }

.result-label {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tone, var(--muted));
}
.result-text {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.result-text.empty { font-family: var(--sans); font-size: 1rem; font-weight: 400; color: var(--muted); }
.result-text.shuffling { color: #c9b5aa; filter: blur(3px); }
.ticket.reveal .result-text { animation: reveal .5s cubic-bezier(.2, .9, .3, 1.3); }

.result-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.result-actions button[hidden] { display: none; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
  font-size: .85rem;
  color: var(--muted);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px) scale(.94); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
