:root {
  color-scheme: light;
  --navy: #182c4f;
  --navy-2: #25446f;
  --paper: #f4f7fb;
  --card: #ffffff;
  --ink: #18243a;
  --muted: #68758a;
  --line: #dfe6f0;
  --coral: #e85d3f;
  --coral-dark: #bf432b;
  --gold: #f0b429;
  --green: #16865b;
  --red: #c33b43;
  --blue-soft: #e9f0fb;
  --shadow: 0 12px 35px rgba(24, 44, 79, .09);
  --radius: 20px;
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.45; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(232, 93, 63, .28); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .48; }
.hidden { display: none !important; }

.boot-screen, .login-shell, .setup-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.boot-screen { align-content: center; gap: 14px; color: var(--muted); }
.brand-mark { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 21px; background: var(--navy); color: white; font-size: 2rem; font-weight: 850; box-shadow: var(--shadow); letter-spacing: -.05em; }
.brand-mark sup { color: var(--gold); font-size: .5em; margin-left: 1px; }
.auth-card { width: min(100%, 470px); border-radius: 28px; background: var(--card); padding: 26px; box-shadow: var(--shadow); border: 1px solid rgba(223, 230, 240, .8); }
.auth-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.auth-head h1 { margin: 0; font-size: 1.65rem; letter-spacing: -.03em; }
.auth-head p { margin: 2px 0 0; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.profile-button { min-height: 105px; border: 1px solid var(--line); background: #fff; border-radius: 18px; display: grid; justify-items: center; align-content: center; gap: 7px; color: var(--ink); }
.profile-button.selected { border-color: var(--coral); background: #fff5f2; box-shadow: 0 0 0 2px rgba(232,93,63,.12); }
.avatar { --avatar: var(--navy); width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; background: var(--avatar); font-weight: 800; font-size: 1.1rem; flex: 0 0 auto; }
.avatar.gaming { background: linear-gradient(145deg, #111c38, #4d2f78); box-shadow: 0 0 0 3px rgba(115, 87, 184, .14); }
.pin-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.app-shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; height: 68px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: rgba(244,247,251,.92); backdrop-filter: blur(15px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(223,230,240,.75); }
.wordmark { font-weight: 900; font-size: 1.35rem; letter-spacing: -.04em; color: var(--navy); }
.wordmark sup { color: var(--coral); }
.user-menu { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 3px; color: var(--ink); }
.user-menu .avatar { width: 36px; height: 36px; font-size: .95rem; }
.user-area { position: relative; }
.user-popover { position: absolute; z-index: 50; top: calc(100% + 9px); right: 0; width: 190px; padding: 7px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 16px 40px rgba(17,31,56,.18); }
.user-popover button { width: 100%; min-height: 44px; padding: 9px 10px; border: 0; border-radius: 11px; background: transparent; color: var(--ink); display: flex; align-items: center; gap: 10px; text-align: left; }
.user-popover button:hover { background: var(--blue-soft); }
.user-popover svg { width: 21px; height: 21px; }
.main { width: min(100%, 1020px); margin: 0 auto; padding: 18px 16px 30px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.page-head h1 { font-size: clamp(1.55rem, 4vw, 2rem); margin: 0; letter-spacing: -.04em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.section-title { margin: 28px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title h2 { margin: 0; font-size: 1.13rem; }
.section-title span { color: var(--muted); font-size: .9rem; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 760px); padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(5,1fr); gap: 3px; background: rgba(255,255,255,.96); backdrop-filter: blur(16px); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 35px rgba(24,44,79,.08); }
.nav-button { min-height: 55px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: .72rem; display: grid; place-items: center; align-content: center; gap: 2px; }
.nav-button svg { width: 23px; height: 23px; }
.nav-button.active { color: var(--navy); background: var(--blue-soft); font-weight: 750; }
.count-dot { position: absolute; margin: -35px 0 0 20px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: .68rem; display: grid; place-items: center; }

.score-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.score-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 13px; box-shadow: 0 5px 16px rgba(24,44,79,.05); }
.score-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.score-person .avatar { width: 30px; height: 30px; font-size: .78rem; }
.score-person span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.score-value { display: block; font-size: 1.55rem; font-weight: 900; color: var(--navy); margin-top: 8px; }
.score-value small { font-size: .7rem; color: var(--muted); font-weight: 600; }

.notice { background: #fff7df; border: 1px solid #efd999; color: #6d5210; border-radius: 17px; padding: 13px 15px; margin: 16px 0; display: flex; gap: 11px; align-items: flex-start; }
.notice strong { display: block; }
.notice p { margin: 2px 0 0; font-size: .91rem; }
.card-list { display: grid; gap: 12px; }
.challenge-card, .panel, .reward-card, .activity-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 20px rgba(24,44,79,.055); }
.challenge-card { padding: 17px; position: relative; overflow: hidden; }
.challenge-card.gianluca { border-left: 4px solid #7557b8; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title { margin: 8px 0 4px; font-size: 1.08rem; line-height: 1.3; }
.card-desc { color: var(--muted); margin: 0 0 13px; white-space: pre-wrap; }
.penalty-box, .giani-penalty { margin: 12px 0; padding: 12px 13px; border-radius: 14px; background: #fdebee; color: #8e2630; border: 1px solid #f2cbd0; }
.penalty-box p, .giani-penalty p { margin: 3px 0 0; white-space: pre-wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 750; background: var(--blue-soft); color: var(--navy-2); }
.badge.main-badge { background: #fff0ec; color: var(--coral-dark); }
.badge.points { background: #fff7d7; color: #765500; }
.badge.success { background: #e5f6ef; color: #0c6e49; }
.badge.danger { background: #fdebee; color: #a72b36; }
.badge.pending { background: #fff3d7; color: #7a5800; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.meta { color: var(--muted); font-size: .82rem; }
.meta strong { display: block; color: var(--ink); font-size: .9rem; margin-top: 2px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { border: 0; border-radius: 13px; min-height: 44px; padding: 10px 15px; background: var(--navy); color: #fff; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn.primary { background: var(--coral); }
.btn.secondary { background: var(--blue-soft); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: #fdebee; color: var(--red); }
.btn.small { min-height: 36px; padding: 7px 11px; border-radius: 11px; font-size: .86rem; }
.btn.wide { width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--navy); }
.fab { position: fixed; right: max(18px, calc((100vw - 1020px)/2 + 18px)); bottom: calc(88px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border: 0; border-radius: 18px; background: var(--coral); color: #fff; font-size: 2rem; line-height: 1; box-shadow: 0 13px 28px rgba(232,93,63,.28); z-index: 21; }

.tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--muted); min-height: 39px; padding: 8px 13px; border-radius: 999px; }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty { text-align: center; padding: 34px 20px; border: 1px dashed #cbd5e3; border-radius: var(--radius); color: var(--muted); background: rgba(255,255,255,.55); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.panel { padding: 18px; }
.rank-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.rank-no { font-size: 1.2rem; font-weight: 900; color: var(--muted); text-align: center; }
.rank-row:first-child { background: linear-gradient(110deg, #fff9e7, #fff); border-color: #eedc9f; }
.rank-score { font-size: 1.2rem; font-weight: 900; color: var(--navy); }
.progress-track { height: 12px; background: #e4e9f2; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #7557b8, #41b6a6); border-radius: inherit; transition: width .5s ease; }
.savings-hero { padding: 22px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 90% 10%, rgba(128,97,205,.8), transparent 35%), linear-gradient(135deg, #17233f, #34265a); box-shadow: var(--shadow); }
.savings-hero h2 { margin: 0; }
.money { font-size: clamp(2rem, 9vw, 3rem); font-weight: 900; letter-spacing: -.05em; margin: 16px 0 4px; }
.savings-hero .progress-track { background: rgba(255,255,255,.18); margin: 16px 0 8px; }
.savings-hero .progress-fill { background: linear-gradient(90deg, #63e6be, #ffd166); }
.savings-hero p { margin: 0; color: rgba(255,255,255,.75); }
.entry-row, .activity-item { padding: 13px 15px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.entry-row + .entry-row { border-top: 1px solid var(--line); }
.entry-amount { font-weight: 850; white-space: nowrap; }
.entry-amount.negative { color: var(--red); }
.entry-amount.positive { color: var(--green); }
.muted { color: var(--muted); }
.small-text { font-size: .84rem; }

.form-grid { display: grid; gap: 15px; }
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 750; font-size: .9rem; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #cfd8e6; border-radius: 13px; padding: 11px 12px; min-height: 46px; background: #fff; color: var(--ink); }
.field textarea { min-height: 105px; resize: vertical; }
.field small { color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.choice { border: 1px solid var(--line); padding: 12px; border-radius: 15px; background: #fff; text-align: left; }
.choice.selected { border-color: var(--coral); background: #fff5f2; box-shadow: 0 0 0 2px rgba(232,93,63,.11); }
.choice strong, .choice small { display: block; }
.choice small { color: var(--muted); margin-top: 2px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; }
.form-error { background: #fdebee; color: #9b2630; border-radius: 12px; padding: 10px 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(9,18,35,.52); display: grid; place-items: end center; padding: 18px 0 0; }
.modal { width: min(100%, 620px); max-height: min(92vh, 820px); overflow-y: auto; background: var(--paper); border-radius: 26px 26px 0 0; box-shadow: 0 -15px 55px rgba(9,18,35,.25); padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-head p { margin: 3px 0 0; color: var(--muted); }
.modal-close { border: 0; background: #e8edf5; width: 38px; height: 38px; border-radius: 12px; font-size: 1.3rem; }
.photo-preview { width: 100%; max-height: 240px; object-fit: cover; border-radius: 15px; border: 1px solid var(--line); }

.instruction-photo-link { display: block; width: 112px; height: 112px; margin: 0 auto 14px; border: 1px solid #d9e0ed; border-radius: 19px; background: #eef2f8; overflow: hidden; }
.instruction-photo { display: block; width: 100%; height: 100%; object-fit: contain; background: #eef2f8; }
.challenge-symbol { display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 12px; border-radius: 22px; background: linear-gradient(145deg, #eef3fb, #fff); border: 1px solid var(--line); font-size: 2.45rem; }
.image-upload { padding: 13px; border: 2px dashed #cbd6e7; border-radius: 16px; background: #f9fbfe; }
.visual-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.visual-choice { min-width: 0; min-height: 68px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 7px 3px; color: var(--ink); }
.visual-choice span, .visual-choice small { display: block; }
.visual-choice span { font-size: 1.65rem; line-height: 1.1; }
.visual-choice small { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; font-size: .66rem; color: var(--muted); }
.visual-choice.selected { border-color: var(--coral); background: #fff1ec; box-shadow: 0 0 0 2px rgba(232,93,63,.14); }

/* Gianis Ansicht ist bewusst bildorientiert und hat größere Aktionsflächen. */
.giani-mode { --paper: #edf0f9; --ink: #111a31; }
.giani-mode .topbar { background: rgba(18,25,48,.94); border-color: rgba(255,255,255,.08); }
.giani-mode .wordmark, .giani-mode .user-menu { color: #fff; }
.giani-mode .bottom-nav { background: rgba(17,24,45,.97); border-color: rgba(255,255,255,.08); }
.giani-mode .nav-button { color: #aeb9d2; }
.giani-mode .nav-button.active { color: #fff; background: #6047a0; }
.giani-mode .count-dot { background: #ff735f; }
.giani-hero { position: relative; overflow: hidden; min-height: 190px; padding: 24px; color: #fff; border-radius: 26px; background: radial-gradient(circle at 85% 20%, rgba(157,107,255,.92), transparent 34%), linear-gradient(135deg, #101a34, #312258); box-shadow: 0 16px 38px rgba(27,26,67,.24); }
.giani-hero::after { content: ''; position: absolute; inset: auto -40px -75px auto; width: 200px; height: 200px; border: 24px solid rgba(255,255,255,.05); border-radius: 50%; }
.giani-kicker { color: #6de6c8; font-size: .77rem; font-weight: 900; letter-spacing: .15em; }
.giani-hero h1 { position: relative; z-index: 1; margin: 3px 0 13px; font-size: clamp(2rem, 9vw, 3rem); line-height: 1; }
.giani-score { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: rgba(255,255,255,.1); backdrop-filter: blur(6px); }
.giani-score span { font-size: 1.6rem; }
.giani-score strong { font-size: 1.7rem; }
.giani-score small { color: #dfe6ff; font-weight: 700; }
.giani-controller { position: absolute; z-index: 1; right: 24px; top: 40px; font-size: clamp(4rem, 20vw, 7rem); transform: rotate(-8deg); filter: drop-shadow(0 10px 10px rgba(0,0,0,.22)); }
.giani-section-head { display: flex; align-items: center; gap: 12px; margin: 28px 0 12px; }
.giani-section-head.compact { margin-top: 32px; }
.giani-section-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border-radius: 15px; background: #fff; box-shadow: 0 7px 18px rgba(24,44,79,.08); font-size: 1.55rem; }
.giani-section-head h2, .giani-section-head p { margin: 0; }
.giani-section-head h2 { font-size: 1.3rem; }
.giani-section-head p { color: var(--muted); font-weight: 650; }
.giani-task-list { display: grid; gap: 16px; }
.giani-task { overflow: hidden; border: 2px solid #cfd7ea; border-radius: 25px; background: #fff; box-shadow: 0 11px 28px rgba(25,32,68,.1); }
.giani-task.active { border-color: #ff856f; }
.giani-task.offered { border-color: #7759be; }
.giani-task.provisional, .giani-task.grace { border-color: #eebd45; }
.giani-task-media { width: 112px; height: 112px; margin: 16px auto 0; border: 1px solid #d9e0ed; border-radius: 19px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, #e8ecfa, #fafbff); }
.giani-task-media img { width: 100%; height: 100%; object-fit: contain; background: #eef2f8; }
.giani-task-media > span { font-size: 4rem; filter: drop-shadow(0 8px 8px rgba(24,30,65,.12)); }
.giani-status-line, .giani-task h3, .giani-facts, .giani-details, .giani-actions { margin-left: 18px; margin-right: 18px; }
.giani-status-line { margin-top: 16px; color: #553892; font-size: 1.04rem; }
.giani-task.active .giani-status-line { color: #c7442f; }
.giani-task h3 { margin-top: 7px; margin-bottom: 12px; font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.18; letter-spacing: -.025em; }
.giani-facts { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.visual-points, .giani-time { display: inline-flex; align-items: center; min-height: 46px; padding: 9px 13px; border-radius: 14px; font-weight: 850; }
.visual-points { background: #fff5cc; color: #6e5200; letter-spacing: .04em; }
.giani-time { background: #eaf0ff; color: #203d77; }
.giani-details { border: 1px solid #dce3ef; border-radius: 15px; background: #f7f9fc; }
.giani-details summary { min-height: 48px; padding: 12px 14px; cursor: pointer; font-weight: 850; }
.giani-details p { margin: 0; padding: 0 14px 14px; color: #4f5d73; white-space: pre-wrap; }
.giani-penalty { margin-left: 18px; margin-right: 18px; }
.giani-actions { display: grid; grid-template-columns: 1fr; margin-top: 16px; margin-bottom: 18px; }
.giani-actions .btn { width: 100%; min-height: 58px; border-radius: 17px; font-size: 1.08rem; }
.giani-actions .btn.primary { background: linear-gradient(135deg, #ed6148, #ff7d5b); box-shadow: 0 9px 20px rgba(232,93,63,.24); }

.toast-region { position: fixed; z-index: 200; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 28px), 480px); display: grid; gap: 8px; pointer-events: none; }
.toast { background: #15233d; color: #fff; padding: 12px 15px; border-radius: 14px; box-shadow: var(--shadow); animation: toast-in .22s ease-out; }
.toast.error { background: #a72b36; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 720px) {
  .main { padding-top: 28px; }
  .card-list.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { place-items: center; padding: 24px; }
  .modal { border-radius: 26px; max-height: min(88vh, 820px); }
  .giani-task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .score-strip { gap: 6px; }
  .score-card { padding: 10px 8px; }
  .score-person { gap: 5px; }
  .score-person .avatar { width: 26px; height: 26px; }
  .score-person span:last-child { font-size: .76rem; }
  .score-value { font-size: 1.3rem; }
  .nav-button span { font-size: .66rem; }
  .field-row { grid-template-columns: 1fr; }
  .visual-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .giani-controller { right: 14px; opacity: .88; }
}

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