@font-face { font-family: 'Rostov'; src: url('fonts/Rostov.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Dopestyle'; src: url('fonts/mr_dopestyleg.otf') format('opentype'); font-display: swap; }

:root {
  --green: #385144;
  --green-90: #2d4237;
  --cream: #f8f5f2;
  --card: #fffdfb;
  --ink: #385144;
  --muted: rgba(56, 81, 68, 0.55);
  --faint: rgba(56, 81, 68, 0.28);
  --tint: rgba(56, 81, 68, 0.07);
  --line: rgba(56, 81, 68, 0.14);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background-color: var(--cream);
  /* Лёгкое «бумажное» зерно, как в фирменных каруселях. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .22 0 0 0 0 .32 0 0 0 0 .27 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: 'Rostov', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  min-height: 100vh;
}

#app { max-width: 480px; margin: 0 auto; padding: 20px 16px 0; }

.top { margin-bottom: 18px; }
.wordmark { font-size: 12px; letter-spacing: 0.32em; color: var(--muted); }
h1 { font-family: 'Dopestyle', 'Rostov', serif; font-weight: 400; font-size: 40px; line-height: 1.05; margin: 8px 0 6px; }
.what { margin: 0; color: var(--muted); font-size: 15px; }

.label { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

.duration { margin-bottom: 14px; }
.pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--tint); padding: 4px; border-radius: 14px; }
.pills button {
  border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px;
  padding: 10px 0; border-radius: 10px; cursor: pointer; transition: background .15s, color .15s;
}
.pills button.on { background: var(--green); color: var(--cream); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px 12px; box-shadow: 0 6px 24px rgba(56, 81, 68, 0.06); }

.month { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-title { font-family: 'Dopestyle', 'Rostov', serif; font-size: 26px; }
.nav {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.nav:disabled { opacity: .25; cursor: default; }

.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays span { font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.grid { row-gap: 4px; }

.day {
  position: relative; width: 42px; height: 42px; margin: 0 auto; padding: 0;
  border: 0; background: transparent; color: var(--faint); font: inherit; font-size: 16px;
  border-radius: 50%; cursor: default;
}
.day.empty { visibility: hidden; }
.day.free { color: var(--ink); cursor: pointer; }
.day.free::after {
  content: ''; position: absolute; left: 50%; bottom: 13%; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--green);
}
.day.today { box-shadow: inset 0 0 0 1px var(--faint); }
.day.sel { background: var(--green); color: var(--cream); }
.day.sel::after { background: var(--cream); }

.legend { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 10px 6px 2px; }
.legend .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; }

.slots { margin-top: 18px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 15px;
  padding: 12px 6px; border-radius: 12px; cursor: pointer; transition: background .15s, color .15s;
}
.chip.on { background: var(--green); border-color: var(--green); color: var(--cream); }
.slots .empty-day { color: var(--muted); font-size: 15px; }

.note { color: var(--muted); font-size: 13px; text-align: center; margin: 20px 0 0; }
.spacer { height: 150px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cream);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(56, 81, 68, 0.08);
}
.bar-text { min-width: 0; }
.bar-when { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-sub { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-line; line-height: 1.4; }

.book {
  border: 0; background: var(--green); color: var(--cream); font: inherit; font-size: 16px;
  padding: 14px 20px; border-radius: 14px; cursor: pointer; white-space: nowrap;
}
.book:active { background: var(--green-90); }
.book:disabled { opacity: .5; }

.state {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; background: var(--cream);
}
.state-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--green); color: var(--cream);
  display: flex; align-items: center; justify-content: center; font-size: 38px; margin-bottom: 18px;
}
.state h2 { font-family: 'Dopestyle', 'Rostov', serif; font-weight: 400; font-size: 36px; margin: 0 0 10px; }
.state p { color: var(--muted); margin: 0 0 24px; line-height: 1.45; max-width: 320px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 96px; margin: 0 auto; max-width: 420px;
  background: var(--green); color: var(--cream); padding: 12px 16px; border-radius: 12px; text-align: center; font-size: 15px;
}

.loading .grid, .loading .chips { opacity: .4; pointer-events: none; }
