.header-wrap {
  position: sticky;
  top: 0;
  z-index: 24;
  background:
    radial-gradient(circle at 86% 10%, rgba(255, 255, 255, 0.18) 0 24%, transparent 25%),
    linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #ffffff;
  padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
  border: 1px solid rgba(214, 97, 43, 0.52);
  border-top: 0;
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  backdrop-filter: blur(10px) saturate(125%);
  box-shadow:
    0 10px 22px rgba(176, 64, 16, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  overflow: hidden;
  isolation: isolate;
}

.header-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 156px;
  height: 156px;
  transform: translate(44%, -44%);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 36%, rgba(255, 255, 255, 0.34) 0 30%, rgba(255, 255, 255, 0.08) 62%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.header-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.header-title {
  margin: 0;
  font-size: 31px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.header-subtitle {
  margin: 6px 0 0;
  color: rgba(255, 247, 241, 0.88);
  font-size: 14px;
  line-height: 1.32;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px;
  min-width: 0;
  width: 100%;
}

.card + .card {
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    background-color var(--transition-base),
    color var(--transition-base);
}

.btn:active {
  transform: translateY(1px);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 93, 36, 0.24);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #ffffff;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  box-shadow: 0 14px 22px rgba(232, 93, 36, 0.28);
}

.btn-ghost {
  background: #fffdfa;
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-ghost:hover {
  background: #fff8f2;
  border-color: #cbbba9;
}

.btn-danger {
  background: #fff1ef;
  color: var(--danger);
  border-color: #f2cac5;
}

.btn-danger:hover {
  background: #ffebe8;
  border-color: #e9b3ab;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  color: #7f776d;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  min-height: 42px;
  padding: 10px 12px;
  background: #fffdfa;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: #f3a772;
  box-shadow: 0 0 0 3px rgba(232, 93, 36, 0.12);
  outline: none;
  background: #ffffff;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a59e95;
}

.field textarea {
  resize: vertical;
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: auto;
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.helper-text input[type="checkbox"],
.helper-text input[type="radio"] {
  margin-right: 6px;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #fce9da;
  color: #99532c;
  border: 1px solid #f4c7a8;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(580px, 100%);
  border: 1px solid rgba(237, 224, 212, 0.9);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(
    155deg,
    rgba(255, 248, 242, 0.78) 0%,
    rgba(251, 245, 238, 0.7) 58%,
    rgba(250, 234, 222, 0.56) 100%
  );
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: clamp(6px, 1.6vw, 10px);
  z-index: 40;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--transition-base),
    opacity var(--transition-fast);
  box-shadow:
    0 -14px 28px rgba(38, 27, 17, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.bottom-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.58) 0%,
    rgba(255, 255, 255, 0.18) 38%,
    rgba(250, 234, 222, 0.22) 100%
  );
  z-index: 0;
}

.bottom-nav::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
  z-index: 1;
}

.bottom-nav .bottom-nav-btn {
  position: relative;
  z-index: 2;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 248, 242, 0.18);
  width: auto;
  min-width: 0;
  min-height: clamp(46px, 9.4vw, 54px);
  flex: 1 1 0;
  padding: 0 9px;
  color: #b09880;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    transform var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    flex-basis var(--transition-base);
}

.bottom-nav .bottom-nav-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(237, 224, 212, 0.88);
}

.bottom-nav .bottom-nav-btn.active {
  color: var(--accent);
  background: linear-gradient(145deg, rgba(224, 90, 37, 0.2) 0%, rgba(224, 90, 37, 0.14) 100%);
  border-color: rgba(245, 208, 200, 0.95);
  width: auto;
  min-width: 0;
  max-width: none;
  justify-content: flex-start;
  flex: 1.36 1 0;
  gap: 7px;
  padding: 0 12px;
  box-shadow:
    0 8px 14px rgba(224, 90, 37, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.bottom-nav-icon {
  width: clamp(20px, 5vw, 25px);
  height: clamp(20px, 5vw, 25px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-icon-svg {
  width: clamp(20px, 5vw, 25px);
  height: clamp(20px, 5vw, 25px);
}

.bottom-nav-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-4px);
  font-size: 12px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition:
    max-width var(--transition-base),
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.bottom-nav .bottom-nav-btn.active .bottom-nav-label {
  max-width: clamp(56px, 20vw, 96px);
  opacity: 1;
  transform: translateX(0);
}

body.keyboard-open .bottom-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(calc(100% + 16px));
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.slot-chip {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdfa;
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.slot-chip.active {
  border-color: var(--accent);
  background: #fff0e6;
  color: #8a421a;
  font-weight: 800;
}

.slot-chip.disabled {
  opacity: 0.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(31, 28, 24, 0.94);
  color: #ffffff;
  padding: 10px 13px;
  border-radius: 999px;
  font-size: 12px;
  z-index: 50;
  max-width: calc(100vw - 24px);
  text-align: center;
  box-shadow: 0 10px 20px rgba(22, 18, 12, 0.3);
}

.modal-sheet {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 13, 0.3);
  -webkit-backdrop-filter: blur(6px) saturate(115%);
  backdrop-filter: blur(6px) saturate(115%);
  display: flex;
  align-items: flex-end;
  z-index: 60;
}

.modal-sheet > .sheet {
  position: relative;
  width: 100%;
  background: linear-gradient(170deg, rgba(255, 248, 242, 0.94) 0%, rgba(251, 245, 238, 0.82) 100%);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid rgba(237, 224, 212, 0.94);
  border-left: 1px solid rgba(237, 224, 212, 0.8);
  border-right: 1px solid rgba(237, 224, 212, 0.8);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  backdrop-filter: blur(16px) saturate(120%);
  box-shadow:
    0 -18px 34px rgba(28, 22, 15, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.modal-sheet > .sheet::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.modal-sheet > .sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 34%);
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 235, 214, 0.34) 0 20%, transparent 20%),
    radial-gradient(circle at 9% 84%, rgba(255, 235, 214, 0.22) 0 18%, transparent 18%),
    linear-gradient(168deg, #eb6a34 0%, #df551f 62%, #b84a1e 100%);
  transition: opacity 0.24s ease;
}

.app-splash-hidden {
  opacity: 0;
  pointer-events: none;
}

.app-splash-inner {
  width: 100%;
  min-height: 100dvh;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.app-splash-scene {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  min-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
  min-height: calc(100vh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.app-splash-scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.app-splash-tap {
  position: absolute;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 8px);
  transform: translateX(-50%);
  font-family: "Montserrat", "Inter", sans-serif;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.44);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

@media (max-width: 480px) {
  .header-wrap {
    padding: calc(13px + env(safe-area-inset-top)) 12px 12px;
  }

  .header-wrap::before {
    width: 146px;
    height: 146px;
    transform: translate(46%, -46%);
  }

  .header-title {
    font-size: 22px;
  }

  .header-subtitle {
    font-size: 12px;
  }

  .app-splash-scene {
    min-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    min-height: calc(100vh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    border-radius: 0;
    padding: 0;
  }

  .card {
    padding: 11px;
    border-radius: 15px;
  }

  .btn {
    border-radius: 12px;
    padding: 10px 12px;
  }

  .btn-sm {
    padding: 7px 9px;
    font-size: 11px;
  }

  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .bottom-nav .bottom-nav-btn {
    width: auto;
    min-width: 0;
    min-height: 45px;
    flex: 1 1 0;
    padding: 0 9px;
  }

  .bottom-nav-icon,
  .bottom-nav-icon-svg {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-label {
    font-size: 11px;
  }

  .bottom-nav .bottom-nav-btn.active .bottom-nav-label {
    max-width: 74px;
  }

  .toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .header-wrap {
    padding: calc(11px + env(safe-area-inset-top)) 10px 10px;
  }

  .header-wrap::before {
    width: 134px;
    height: 134px;
    transform: translate(48%, -48%);
  }

  .card {
    padding: 9px;
    border-radius: 13px;
  }

  .app-splash-scene {
    min-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    min-height: calc(100vh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    border-radius: 0;
    padding: 0;
  }

  .btn {
    min-height: 38px;
    padding: 9px 10px;
    font-size: 12px;
  }

  .btn-sm {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .field {
    margin-bottom: 8px;
  }

  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea {
    min-height: 38px;
    padding: 8px 10px;
  }

  .bottom-nav {
    gap: 5px;
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
  }

  .bottom-nav .bottom-nav-btn {
    width: auto;
    min-width: 0;
    min-height: 43px;
    flex: 1 1 0;
    padding: 0 8px;
  }

  .bottom-nav .bottom-nav-btn.active {
    max-width: none;
    flex: 1.24 1 0;
    gap: 5px;
    padding: 0 10px;
  }

  .bottom-nav-icon,
  .bottom-nav-icon-svg {
    width: 19px;
    height: 19px;
  }

  .bottom-nav .bottom-nav-btn.active .bottom-nav-label {
    max-width: 70px;
  }
}
