/* Палитра «пыльная роза и нюд» */
:root {
  --bg: #f6ede6;
  --bg-glow: #f3dcd6;
  --surface: #fffaf6;
  --surface-2: #f3e6dd;
  --text: #4a3434;
  --muted: #967c77;
  --border: #e7d4ca;
  --accent: #a4666a;
  --accent-2: #c48f8e;
  --accent-text: #ffffff;
  --accent-soft: #f2dedb;
  --danger: #b24a50;
  --shadow: 0 1px 2px rgba(122, 76, 72, .06), 0 8px 24px rgba(122, 76, 72, .08);
  --radius: 20px;
  --tap: 44px;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #221a1b;
    --bg-glow: #33242a;
    --surface: #2e2425;
    --surface-2: #3a2e2f;
    --text: #f3e6de;
    --muted: #b89f99;
    --border: #4a3b3c;
    --accent: #d4a0a0;
    --accent-2: #b98282;
    --accent-text: #2a1c1d;
    --accent-soft: #46313a;
    --danger: #ef8f8f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 100% 0%, var(--bg-glow) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: .01em;
  color: var(--accent);
}
h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--tap);
}

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

.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* Сегментированный переключатель (профиль, вкладки) */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.segmented button {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 6px 4px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .2s, color .2s;
}
.segmented [aria-checked="true"],
.segmented [aria-selected="true"] {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(164, 102, 106, .3);
}
.segmented .locked::after { content: " 🔒"; font-size: 12px; }
.segmented-sm { margin-top: -6px; }
.season-note { margin: -8px 0 0; text-align: center; }

.control {
  min-height: var(--tap);
  padding: 10px 14px;
  font: inherit;
  font-size: 16px; /* не даёт iOS зумить при фокусе */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  width: 100%;
}
.control::placeholder { color: var(--muted); }
.control:focus { border-color: var(--accent); background: var(--surface); }
select.control { width: auto; }
textarea.control { resize: vertical; display: block; margin: 10px 0; }

.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-text);
  border-color: transparent;
}
.btn-ghost { background: transparent; border-color: transparent; padding: 10px 8px; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-big {
  min-height: 60px;
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(164, 102, 106, .35);
}
.btn-big:disabled { box-shadow: none; }

.bulk { margin-top: 12px; }
.bulk summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.bulk summary::-webkit-details-marker { display: none; }
.bulk summary::before { content: "▸"; margin-right: 8px; transition: transform .15s; }
.bulk[open] summary::before { transform: rotate(90deg); }

.items-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}

.items {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.items li { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); }
.items li:first-child { border-top: 0; }
.item-text {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 8px 4px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
}
.item-text:focus { background: var(--surface-2); border-color: var(--accent); padding: 8px; }
.item-del {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.item-del:active { color: var(--danger); background: var(--surface-2); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { margin: 8px 0 0; text-align: center; }
.hint { margin: -6px 0 0; text-align: center; font-size: 14px; }

.count-row label { font-weight: 600; }
.count-row .small { display: block; font-weight: 400; }
.count-select { min-width: 96px; text-align: center; }

.result h2 { margin-bottom: 8px; }
.result .btn { padding: 10px 8px; white-space: nowrap; }
.result-list { margin: 0 0 14px; padding-left: 30px; font-size: 18px; }
.result-list li { padding: 7px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.result-list li:last-child { border-bottom: 0; }
.result-list li::marker { color: var(--accent); font-family: var(--serif); font-weight: 700; }
.phrases {
  margin: 0 0 14px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 16px;
}
.phrases h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.phrases-list { list-style: none; margin: 0; padding: 0; }
.phrases-list li {
  padding: 4px 0;
  font-family: var(--serif);
  font-size: 21px;
  font-style: italic;
  line-height: 1.25;
}
.phrases-list li::before { content: "«"; color: var(--accent); }
.phrases-list li::after { content: "»"; color: var(--accent); }
.result.flash { animation: flash .4s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: var(--surface); } }

/* Подтверждение возраста */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(46, 28, 30, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-box {
  width: 100%;
  max-width: 360px;
  padding: 26px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: center;
}
.modal-box h2 { font-size: 23px; margin: 12px 0 6px; }
.modal-box p { margin: 0 0 20px; color: var(--muted); }
.modal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] { display: none !important; }

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