/* Trinkgeld-Helfer CH — warmes Gold/Bernstein auf dunklem, gastlichem Grund */

:root {
  --amber: #d97706;
  --amber-bright: #f59e0b;
  --amber-soft: #fbbf24;
  --amber-deep: #b45309;

  /* Dunkel (Standard) */
  --bg: #1a120b;
  --bg-grad-a: #221710;
  --bg-grad-b: #150d07;
  --surface: #2a1d12;
  --surface-2: #332417;
  --surface-line: #4a3621;
  --text: #f7ecdf;
  --text-dim: #c9b39a;
  --text-faint: #9a8167;
  --accent: var(--amber-soft);
  --accent-strong: var(--amber-bright);
  --on-accent: #2a1605;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --ring: rgba(245, 158, 11, 0.55);
  --danger: #f0a868;
}

[data-theme="light"] {
  --bg: #fdf6ec;
  --bg-grad-a: #fff7ea;
  --bg-grad-b: #f6e7cf;
  --surface: #ffffff;
  --surface-2: #fbf1e2;
  --surface-line: #ecd8ba;
  --text: #3a2810;
  --text-dim: #6b5232;
  --text-faint: #98794f;
  --accent: var(--amber-deep);
  --accent-strong: var(--amber);
  --on-accent: #fff7ea;
  --shadow: 0 14px 34px rgba(120, 72, 12, 0.16);
  --ring: rgba(217, 119, 6, 0.5);
  --danger: #b45309;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(217, 119, 6, 0.16), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent-strong);
  color: var(--on-accent);
  padding: 10px 14px;
  border-radius: 0 0 10px 0;
  z-index: 50;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 18px 6px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--on-accent);
  background: linear-gradient(145deg, var(--amber-soft), var(--amber-deep));
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.18rem; letter-spacing: 0.2px; }
.brand-sub { font-size: 0.74rem; color: var(--text-faint); font-weight: 600; }

.theme-toggle {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 14px;
  border: 1px solid var(--surface-line);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 1.3rem;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent); }
.theme-icon { grid-area: 1 / 1; transition: opacity 0.2s ease, transform 0.3s ease; }
.theme-icon-light { opacity: 0; transform: scale(0.4) rotate(-90deg); }
[data-theme="light"] .theme-icon-dark { opacity: 0; transform: scale(0.4) rotate(90deg); }
[data-theme="light"] .theme-icon-light { opacity: 1; transform: scale(1) rotate(0); }
[data-theme="dark"] .theme-icon-dark { opacity: 1; }

/* Layout */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 20px;
  padding: 20px 18px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 16px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--accent);
  font-weight: 800;
}

/* Fields */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field > label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 2px solid var(--surface-line);
  border-radius: 16px;
  padding: 6px 10px 6px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.amount-row:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--ring);
}

.cur {
  font-weight: 800;
  color: var(--text-faint);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

#amount {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 2rem;
  font-weight: 800;
  padding: 8px 0;
  outline: none;
  font-variant-numeric: tabular-nums;
}
#amount::placeholder { color: var(--text-faint); opacity: 0.6; }

.icon-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-line); color: var(--text); }

.hint {
  margin: 8px 2px 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* People stepper */
.people-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.people-head label { margin: 0; font-weight: 700; font-size: 0.92rem; }
.people-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-btn {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 1px solid var(--surface-line);
  background: var(--surface-2);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}
.step-btn:hover { background: var(--surface-line); border-color: var(--accent); }
.step-btn:active { transform: scale(0.92); }

input[type="range"] {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber-deep), var(--amber-soft));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
}

/* Suggestions */
.empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  padding: 16px 6px;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.sugg {
  text-align: left;
  border: 2px solid var(--surface-line);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px 14px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease;
  color: var(--text);
}
.sugg:hover { transform: translateY(-2px); border-color: var(--accent); }
.sugg:active { transform: translateY(0); }
.sugg.is-active {
  border-color: var(--accent-strong);
  background: linear-gradient(160deg, rgba(245,158,11,0.18), rgba(217,119,6,0.06));
  box-shadow: 0 0 0 3px var(--ring);
}

.sugg-kind {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
}
.sugg-total {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sugg-tip {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Detail card */
.detail-grid { margin: 0; }
.detail-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--surface-line);
}
.detail-line:last-child { border-bottom: 0; }
.detail-line dt { margin: 0; color: var(--text-dim); font-size: 0.9rem; font-weight: 600; }
.detail-line dd {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.detail-line.accent dd { color: var(--accent); }
.detail-line.total dt { color: var(--text); font-weight: 800; font-size: 1rem; }
.detail-line.total dd { font-size: 1.5rem; color: var(--accent-strong); }
#detailTitle span { color: var(--accent); }

/* Footer */
.foot {
  margin-top: 4px;
  text-align: center;
}
.foot p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.55;
  max-width: 42ch;
  margin-inline: auto;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 60;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (max-width: 360px) {
  .suggestions { grid-template-columns: 1fr; }
  #amount { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
