:root {
  --cream: #fbf6e9;
  --paper: #fffdf7;
  --line: #e6dcc0;
  --green: #1f5a3a;
  --green-dark: #154329;
  --green-soft: #e4efe5;
  --red: #b3262d;
  --red-soft: #fbe6e4;
  --text: #25302a;
  --muted: #5d6b62;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.topbar {
  background: var(--green);
  color: #fff;
  border-bottom: 5px solid var(--red);
}

.topbar-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  white-space: nowrap;
}

.who { font-size: .9rem; opacity: .95; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn.small { flex: none; white-space: nowrap; padding: 6px 12px; }

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0 12px; color: var(--green-dark); }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 0 0 10px; color: var(--green-dark); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .95rem; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.card.highlight { border-color: var(--green); background: var(--green-soft); }
.card.warn { border-color: var(--red); background: var(--red-soft); }

.tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  min-height: 52px;
  border-radius: 14px;
  border: 2px solid var(--green);
  color: var(--green);
  background: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.tab.active { background: var(--green); color: #fff; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 20px;
  border: 2px solid var(--green);
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:active { background: var(--green-dark); }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost.red { color: var(--red); }
.btn.light { background: transparent; color: #fff; border-color: #fff; }
.btn.small { width: auto; min-height: 44px; padding: 6px 14px; font-size: .95rem; }
.btn[disabled] { opacity: .6; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-row .btn { flex: 1 1 140px; }

label { display: block; font-weight: 700; margin: 0 0 6px; }
.field { margin: 0 0 14px; }

input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea { min-height: 140px; resize: vertical; }

input:focus, textarea:focus, select:focus, .btn:focus-visible, .tab:focus-visible, a:focus-visible {
  outline: 3px solid #f0b429;
  outline-offset: 2px;
}

input.code {
  text-align: center;
  font-size: 2rem;
  letter-spacing: .5em;
  padding-left: calc(14px + .5em);
}

.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--red); font-weight: 600; }

.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages li {
  padding: 12px 14px;
  margin: 0 0 8px;
  border-radius: 12px;
  border: 1px solid var(--green);
  background: var(--green-soft);
  font-weight: 600;
}
.messages li.error { border-color: var(--red); background: var(--red-soft); color: #7d171c; }

.name-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  background: var(--green-soft);
  color: var(--green-dark);
}
.badge.coeur { background: var(--red); color: #fff; }
.badge.plaisir { background: #f6e3b4; color: #5c4300; }
.badge.off { background: #ece7d6; color: var(--muted); }

.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wish {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}
.wish.coeur { border-left: 6px solid var(--red); }
.wish.plaisir { border-left: 6px solid #e0a82e; }
.wish-name { font-weight: 700; margin: 0 0 4px; }
.wish .btn-row { margin-top: 8px; }

.reveal-name { font-size: 2rem; font-weight: 800; color: var(--red); margin: 0 0 8px; text-align: center; }

.rules { white-space: normal; }

details summary {
  cursor: pointer;
  min-height: 44px;
  padding: 8px 0;
  font-weight: 700;
  color: var(--green);
}

.inline { display: inline; }
.topbar form.inline { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.person {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.person:first-child { border-top: 0; }
.person form.rename { display: flex; gap: 8px; margin: 8px 0; }
.person form.rename input { min-height: 44px; }

.linkbtn {
  background: none;
  border: 0;
  padding: 8px 0;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  color: var(--red);
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 380px) {
  body { font-size: 17px; }
  main { padding: 12px; }
  .card { padding: 14px; }
  input.code { letter-spacing: .35em; }
}
