:root {
  color-scheme: dark;
  --bg: #101217;
  --panel: #151922;
  --panel-2: #1b2230;
  --text: #f4f7fb;
  --muted: #a7b0bf;
  --line: #272f3d;
  --blue: #8fb2ff;
  --green: #35c278;
  --amber: #f59e0b;
  --red: #f87171;
  --shadow: 0 12px 32px rgba(0, 0, 0, .28);
  --touch: clamp(58px, 14vw, 70px);
  --touch-radius: clamp(15px, 3.5vw, 20px);
  --control-font: clamp(25px, 6.2vw, 34px);
  --action-font: clamp(20px, 5.1vw, 27px);
  --action-size: clamp(58px, 14vw, 70px);
  --show-width: clamp(90px, 22vw, 112px);
  --pin-width: clamp(82px, 19vw, 98px);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  font-size: 20px;
}
button, input { font: inherit; }
.app {
  min-height: 100vh;
  width: 100%;
  padding: calc(env(safe-area-inset-top) + 10px) 8px 28px;
  display: grid;
  gap: clamp(7px, 1.8vw, 11px);
  align-content: start;
}
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(10px, 2.6vw, 14px);
  padding: 6px 2px 0;
}
.title { min-width: 0; }
h1 {
  margin: 0;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.18;
  font-weight: 650;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: 100%;
}
.sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: clamp(12px, 3.2vw, 16px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: clamp(7px, 1.8vw, 10px);
  flex-shrink: 0;
}
.primary,
.icon-btn {
  min-height: var(--action-size);
  border-radius: var(--touch-radius);
  display: grid;
  place-items: center;
  line-height: 1;
  position: relative;
  overflow: hidden;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.primary {
  width: var(--show-width);
  border: 0;
  background: #315bdc;
  color: #fff;
  font-weight: 700;
  padding: 0;
  font-size: var(--action-font);
}
.icon-btn {
  width: var(--action-size);
  height: var(--action-size);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow);
}
.icon-btn svg {
  width: clamp(30px, 7.8vw, 42px);
  height: clamp(30px, 7.8vw, 42px);
}
.primary:active,
.icon-btn:active,
.primary.tap-hit,
.icon-btn.tap-hit {
  transform: scale(.93);
  filter: brightness(1.22);
}
.primary.tap-hit {
  box-shadow: 0 0 0 8px rgba(49, 91, 220, .32), 0 10px 26px rgba(49, 91, 220, .36);
}
.icon-btn.tap-hit {
  box-shadow: 0 0 0 8px rgba(143, 178, 255, .2), var(--shadow);
}
.primary::after,
.icon-btn::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: inherit;
  background: rgba(255, 255, 255, .26);
  opacity: 0;
  transform: scale(.55);
  pointer-events: none;
}
.primary.tap-hit::after,
.icon-btn.tap-hit::after {
  animation: tapPulse .34s ease-out;
}
@keyframes tapPulse {
  0% { opacity: .55; transform: scale(.45); }
  100% { opacity: 0; transform: scale(1.75); }
}
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pin-width) var(--show-width);
  gap: clamp(7px, 1.8vw, 10px);
  align-items: center;
}
.controls.pin-hidden {
  grid-template-columns: minmax(0, 1fr) var(--show-width);
}
.field {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--touch-radius);
  background: var(--panel);
  color: var(--text);
  padding: 0 clamp(18px, 4.6vw, 26px);
  outline: none;
  font-size: var(--control-font);
}
.field.pin-hidden {
  display: none;
}
#phoneInput {
  font-size: calc(var(--control-font) * .85);
}
#pinInput {
  padding: 0 clamp(8px, 2vw, 12px);
  text-align: center;
  letter-spacing: .08em;
}
#pinInput[data-masked="true"] {
  font-size: clamp(24px, 6vw, 32px);
}
.field:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.notify-panel {
  display: flex;
  align-items: center;
  padding: 0;
}
.notify-panel.hidden {
  display: none;
}
.notify-btn {
  min-height: var(--action-size);
  height: var(--action-size);
  border: 1px solid rgba(143, 178, 255, .48);
  border-radius: var(--touch-radius);
  background: linear-gradient(180deg, #24324b 0%, #182235 100%);
  color: var(--text);
  font-size: clamp(16px, 4.2vw, 22px);
  font-weight: 700;
  line-height: 1;
  padding: 0 clamp(12px, 3.2vw, 18px);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.notify-btn:active,
.notify-btn.tap-hit {
  transform: scale(.96);
  filter: brightness(1.2);
  box-shadow: 0 0 0 6px rgba(143, 178, 255, .16);
}
.notify-btn.enabled {
  border-color: rgba(53, 194, 120, .62);
  background: linear-gradient(180deg, rgba(53, 194, 120, .34) 0%, #162a22 100%);
  color: #d7ffe6;
}
.notify-status {
  display: none;
}
.calendar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
.calendar-title {
  min-height: clamp(39px, 8.7vw, 52px);
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 800;
  font-size: clamp(27px, 6.2vw, 39px);
}
.weekdays,
.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.grid {
  gap: 5px;
  padding: 5px;
  background: #070a10;
}
.calendar.slide-next .calendar-title,
.calendar.slide-next .grid {
  animation: calendarSlideFromRight .22s ease-out both;
}
.calendar.slide-prev .calendar-title,
.calendar.slide-prev .grid {
  animation: calendarSlideFromLeft .22s ease-out both;
}
@keyframes calendarSlideFromRight {
  from { transform: translateX(24%); opacity: .35; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes calendarSlideFromLeft {
  from { transform: translateX(-24%); opacity: .35; }
  to { transform: translateX(0); opacity: 1; }
}
.weekdays {
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.weekdays div {
  min-height: clamp(35px, 7.4vw, 45px);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: clamp(24px, 5.3vw, 33px);
  font-weight: 700;
}
.weekdays div:first-child { color: #ff9d9d; }
.day {
  appearance: none;
  border: 1px solid #303a4c;
  border-radius: 16px;
  background: linear-gradient(180deg, #202737 0%, #111721 100%);
  min-height: clamp(50px, 12.45vw, 75px);
  padding: clamp(6px, 1.35vw, 10px) clamp(4px, .85vw, 7px);
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 4px;
  color: var(--text);
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 -10px 18px rgba(0, 0, 0, .18),
    0 5px 10px rgba(0, 0, 0, .38);
}
.day .num {
  min-width: clamp(32px, 8vw, 46px);
  height: clamp(32px, 8vw, 46px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: clamp(23px, 5.3vw, 34px);
  font-weight: 750;
}
.day.today .num { background: var(--blue); color: #111827; }
.day.selected {
  border-color: rgba(143, 178, 255, .82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 -10px 18px rgba(0, 0, 0, .18),
    0 0 0 2px rgba(143, 178, 255, .22),
    0 5px 10px rgba(0, 0, 0, .38);
}
.day.sunday {
  background: linear-gradient(180deg, #3a1d25 0%, #211219 100%);
  border-color: #66313d;
}
.day.sunday .num { color: #ffb3b3; }
.day.next .num { background: var(--green); color: #07140d; }
.day.holiday {
  background: linear-gradient(180deg, #3d2c12 0%, #241a0d 100%);
  border-color: #7a5419;
  color: #ffd89a;
}
.day.holiday .num { color: #ffd27a; }
.day.out {
  background: linear-gradient(180deg, #171c26 0%, #0d1118 100%);
  color: #6f7887;
  border-color: #242b38;
}
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(28, 36, 48, .06);
}
.result h2 {
  margin: 0 0 10px;
  font-size: 5.4vw;
  line-height: 1.35;
}
.reservation-list {
  display: grid;
  gap: 10px;
}
.reservation {
  border: 1px solid rgba(53, 194, 120, .5);
  border-radius: 15px;
  padding: 12px 14px;
  margin-top: 0;
  background:
    linear-gradient(135deg, rgba(53, 194, 120, .22), rgba(143, 178, 255, .08) 62%, rgba(245, 158, 11, .09)),
    var(--panel-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 8px 18px rgba(0, 0, 0, .22);
}
.reservation:first-of-type { margin-top: 0; }
.reservation strong {
  display: block;
  font-size: clamp(31px, 7.5vw, 44px);
  line-height: 1.2;
}
.reservation-main {
  display: flex;
  align-items: baseline;
  gap: .42em;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.reservation .warehouse-highlight {
  color: #f9d27b;
  text-shadow: 0 0 12px rgba(245, 158, 11, .34);
}
.reservation .slot-highlight {
  color: #7ef0af;
  text-shadow: 0 0 14px rgba(53, 194, 120, .42);
}
.reservation-detail {
  display: block;
  color: #d7e2f0;
  font-size: 4vw;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.confirm-btn {
  width: 100%;
  min-height: clamp(48px, 12vw, 60px);
  margin-top: 12px;
  border: 1px solid rgba(126, 240, 175, .46);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(53, 194, 120, .34), rgba(22, 67, 47, .72));
  color: #e8fff1;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: 0;
}
.confirm-btn:active {
  transform: scale(.98);
  filter: brightness(1.18);
}
.confirm-btn.confirmed {
  border-color: rgba(143, 178, 255, .52);
  background: linear-gradient(180deg, rgba(143, 178, 255, .25), rgba(36, 50, 75, .88));
  color: #dce8ff;
}
.status {
  color: var(--muted);
  font-size: 4.4vw;
  min-height: 26px;
}
.error { color: var(--red); }
.busy { opacity: .62; pointer-events: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 12, .72);
  backdrop-filter: blur(10px);
}
.modal.hidden {
  display: none;
}
.modal-card {
  width: min(100%, 520px);
  border: 1px solid #354055;
  border-radius: 22px;
  background: linear-gradient(180deg, #1d2431 0%, #121720 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .52);
  padding: clamp(20px, 5vw, 28px);
}
.modal-card h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.2;
}
.modal-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: clamp(16px, 4.2vw, 22px);
  line-height: 1.45;
}
.modal-pin {
  width: 100%;
  min-height: clamp(66px, 17vw, 82px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #101722;
  color: var(--text);
  font-size: clamp(34px, 9vw, 48px);
  font-weight: 700;
  text-align: center;
  letter-spacing: .16em;
  outline: none;
}
.modal-pin:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(143, 178, 255, .18);
}
.modal-message {
  min-height: 26px;
  margin-top: 10px;
  color: var(--red);
  font-size: clamp(15px, 3.9vw, 20px);
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.modal-primary,
.modal-secondary {
  min-height: clamp(56px, 14vw, 70px);
  border-radius: 18px;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 750;
}
.modal-primary {
  border: 0;
  background: #315bdc;
  color: #fff;
}
.modal-secondary {
  border: 1px solid var(--line);
  background: #151b26;
  color: var(--text);
}
@media (max-height: 760px) {
  .day { min-height: clamp(47px, 11.7vw, 70px); }
  .calendar-title { min-height: clamp(37px, 8vw, 50px); }
  .weekdays div { min-height: clamp(33px, 7vw, 43px); }
}
