/* ===== 基础（移动优先） ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --deep-green: #0d1f1a;
  --forest: #1a2f2a;
  --copper: #b87333;
  --copper-light: #d4a574;
  --copper-glow: rgba(184,115,51,0.3);
  --cream: #f5f0e8;
  --text-muted: #a89f91;
  --radius: 14px;
}

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

body {
  font-family: 'Noto Serif SC', system-ui, -apple-system, sans-serif;
  background: var(--deep-green);
  color: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== 品牌 ===== */
.brand-bar {
  text-align: center;
  padding: 40px 0 20px;
}
.brand-bar .brand-icon { font-size: 36px; margin-bottom: 6px; }
.brand-bar h1 {
  font-size: 26px; font-weight: 700;
  color: var(--copper-light); letter-spacing: 6px;
}
.brand-bar .brand-en {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px; color: var(--text-muted); letter-spacing: 3px;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--copper-light); text-decoration: none;
  font-size: 14px; padding: 10px 0; transition: opacity .2s;
}
.back-link:hover { opacity: .7; }

/* ===== 日期横滑 ===== */
.date-scroll-wrap { margin: 0 0 20px; }
.date-scroll {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 4px 0; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.date-scroll::-webkit-scrollbar { display: none; }

.date-chip {
  flex: 0 0 78px; text-align: center;
  padding: 14px 0; border-radius: var(--radius);
  background: var(--forest); border: 1px solid rgba(184,115,51,.12);
  cursor: pointer; transition: all .2s; user-select: none;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}
.date-chip:active { transform: scale(0.96); }
.date-chip.active {
  background: rgba(184,115,51,.15); border-color: var(--copper);
}
.date-chip .week { font-size: 13px; color: var(--text-muted); }
.date-chip .day { font-size: 22px; font-weight: 700; color: var(--cream); line-height: 1.1; }
.date-chip .month { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== 图例 ===== */
.legend {
  display: flex; gap: 28px; justify-content: center;
  margin-bottom: 16px; font-size: 14px; color: var(--text-muted);
}
.legend-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  margin-right: 6px; vertical-align: middle;
}
.legend-dot.free { background: rgba(184,115,51,.25); border: 1px solid var(--copper); }
.legend-dot.taken { background: rgba(190,110,110,.35); border: 1px solid rgba(200,120,120,.4); }

/* ===== 平面图 ===== */
.floor-wrap { margin-bottom: 20px; }
.floor-map {
  position: relative;
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  border: 2px solid rgba(184,115,51,.12);
  border-radius: var(--radius);
  background: var(--forest);
  overflow: hidden;
}

/* SVG 宽高比容器 — 750:625 = 1.2:1 */
.floor-map::before {
  content: ''; display: block;
  padding-top: 83.333%; /* 625/750 */
}

.floor-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  width: 100%; height: 100%;
}

/* 桌位 — 按百分比定位 */
.table-cell {
  position: absolute; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 6px; transition: all .15s; user-select: none;
  z-index: 2; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.table-cell.free {
  background: rgba(184,115,51,.12);
  border: 1.5px solid rgba(184,115,51,.25);
}
.table-cell.free:active {
  background: rgba(184,115,51,.25);
  border-color: var(--copper);
  transform: scale(1.08);
  z-index: 5;
}
.table-cell.taken {
  background: rgba(160,80,80,.15);
  border: 1.5px solid rgba(160,80,80,.3);
  cursor: default;
}
.table-cell.taken:active { opacity: .7; }

.table-cell .table-name {
  font-size: 13px; font-weight: 700; color: var(--copper-light);
  line-height: 1.15; text-align: center;
  white-space: nowrap;
}
.table-cell.taken .table-name { color: rgba(200,150,150,.55); }
.table-cell .table-cap {
  font-size: 11px; color: var(--text-muted); line-height: 1;
  margin-top: 1px;
}
.table-cell.taken .table-cap { color: rgba(200,150,150,.35); }

/* 极小桌位文字适应 */
.table-cell[data-tiny="1"] { border-radius: 4px; }
.table-cell[data-tiny="1"] .table-name { font-size: 10px; }
.table-cell[data-tiny="1"] .table-cap { font-size: 9px; }

/* ===== 弹窗 — 移动端底部弹出 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 100; backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--forest);
  border: 1px solid rgba(184,115,51,.15);
  border-radius: 20px 20px 0 0;
  max-height: 90vh; max-height: 90dvh;
  z-index: 101; box-shadow: 0 -8px 40px rgba(0,0,0,.5);
  overflow-y: auto;
  animation: slideUp .25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-title {
  font-size: 20px; font-weight: 700; color: var(--copper-light);
  padding: 24px 20px 18px; text-align: center;
  letter-spacing: 2px;
}
.modal-close {
  position: absolute; top: 18px; right: 16px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); font-size: 22px;
  border-radius: 50%; transition: all .2s;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:active { background: rgba(184,115,51,.15); color: var(--cream); }

.modal-body { padding: 0 20px; }

.form-row {
  margin-bottom: 18px;
}
.form-row label {
  display: block; font-size: 14px; color: var(--text-muted);
  margin-bottom: 8px; letter-spacing: 1px;
}
.form-row .value {
  font-size: 17px; color: var(--cream); padding: 8px 0;
  border-bottom: 1px solid rgba(184,115,51,.08);
}
.form-row input {
  width: 100%; padding: 14px 16px; border-radius: 10px;
  border: 1px solid rgba(184,115,51,.15);
  background: var(--deep-green); color: var(--cream);
  font-family: inherit; font-size: 16px; outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.form-row input:focus { border-color: var(--copper); }

/* 时段/人数 */
.option-grid {
  display: flex; gap: 10px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 0; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.option-grid::-webkit-scrollbar { display: none; }
.option-chip {
  padding: 10px 18px; border-radius: 22px;
  background: var(--deep-green); border: 1px solid rgba(184,115,51,.15);
  color: var(--text-muted); font-size: 15px; cursor: pointer;
  transition: all .2s; flex-shrink: 0; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none; scroll-snap-align: start;
}
.option-chip:active { transform: scale(0.95); }
.option-chip.selected {
  background: rgba(184,115,51,.18); border-color: var(--copper);
  color: var(--copper-light); font-weight: 600;
}

/* 按钮 */
.btn-row {
  display: flex; gap: 14px;
  padding: 16px 20px 28px; position: sticky; bottom: 0;
  background: var(--forest);
  padding-bottom: max(28px, env(safe-area-inset-bottom, 20px));
}
.btn {
  flex: 1; padding: 15px 0; border-radius: 12px; border: none;
  font-family: inherit; font-size: 17px; cursor: pointer;
  transition: all .2s; letter-spacing: 2px;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-cancel {
  background: transparent; border: 1px solid rgba(184,115,51,.2);
  color: var(--text-muted);
}
.btn-cancel:active { color: var(--cream); border-color: var(--copper); }
.btn-confirm {
  background: var(--copper); color: #fff; font-weight: 700;
}
.btn-confirm:active { background: var(--copper-light); }
.btn-confirm:disabled { opacity: .4; pointer-events: none; }

/* 成功弹窗 (居中) */
.modal.center {
  top: 50%; bottom: auto; left: 50%; right: auto;
  transform: translate(-50%, -50%);
  border-radius: 20px; width: 320px; max-width: 86vw;
  animation: none;
}
.success-icon { font-size: 52px; text-align: center; margin: 24px 0 8px; }
.success-msg { text-align: center; font-size: 20px; color: var(--copper-light); font-weight: 700; }
.success-detail { text-align: center; font-size: 15px; color: var(--text-muted); padding: 8px 0 16px; }

/* ===== 我的预约 ===== */
.my-section {
  background: var(--forest); border-radius: var(--radius);
  border: 1px solid rgba(184,115,51,.08); padding: 20px;
  margin-bottom: 44px;
}
.my-section h3 {
  font-size: 17px; color: var(--copper-light); letter-spacing: 3px;
  margin-bottom: 18px; text-align: center;
}
.my-search { display: flex; gap: 10px; margin-bottom: 18px; }
.my-search input {
  flex: 1; min-width: 0; padding: 13px 16px; border-radius: 10px;
  border: 1px solid rgba(184,115,51,.15);
  background: var(--deep-green); color: var(--cream);
  font-family: inherit; font-size: 15px; outline: none;
  -webkit-appearance: none;
}
.my-search input:focus { border-color: var(--copper); }
.my-search button {
  padding: 0 22px; border-radius: 10px; border: none;
  background: var(--copper); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.my-search button:active { background: var(--copper-light); }

.res-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid rgba(184,115,51,.06);
  flex-wrap: wrap; gap: 10px;
}
.res-card:last-child { border: none; }
.res-card .info { flex: 1; min-width: 0; }
.res-card .info .table { font-size: 17px; font-weight: 700; color: var(--cream); }
.res-card .info .meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-card .badge {
  font-size: 12px; padding: 4px 12px; border-radius: 12px; flex-shrink: 0;
}
.badge-ok { background: rgba(184,115,51,.15); color: var(--copper-light); }
.badge-cancel { background: rgba(150,130,130,.1); color: rgba(160,140,140,.6); }
.badge-done { background: rgba(100,160,100,.1); color: rgba(100,160,100,.6); }
.res-card .btn-sm {
  padding: 8px 18px; border-radius: 8px;
  border: 1px solid rgba(200,100,100,.3);
  background: transparent; color: rgba(220,110,110,.85);
  font-family: inherit; font-size: 13px; cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.res-card .btn-sm:active { background: rgba(180,80,80,.1); }

.empty-tip { text-align: center; color: var(--text-muted); font-size: 15px; padding: 28px 0; }

/* 合桌 */
.merge-link {
  text-align: center; margin: 4px 0 20px;
}
.merge-link a {
  color: var(--copper-light); font-size: 15px; text-decoration: none;
  border-bottom: 1px dashed rgba(184,115,51,.3); padding-bottom: 2px;
  cursor: pointer;
}
.merge-link a:active { border-color: var(--copper); }

/* toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 28px; border-radius: 10px; font-size: 15px;
  z-index: 200; pointer-events: none; max-width: 85vw;
  text-align: center; white-space: nowrap;
  transition: opacity .3s;
}
.toast.error { background: rgba(200,80,80,.92); color: #fff; }
.toast.success { background: rgba(46,204,113,.92); color: #fff; }

/* ===== PC 适配 ===== */
@media (min-width: 601px) {
  .container { padding: 0 24px; }

  .brand-bar { padding: 60px 0 30px; }
  .brand-bar .brand-icon { font-size: 44px; }
  .brand-bar h1 { font-size: 30px; }
  .brand-bar .brand-en { font-size: 14px; }

  .date-chip { flex: 0 0 90px; padding: 16px 0; }
  .date-chip .day { font-size: 26px; }
  .date-chip .week { font-size: 14px; }
  .date-chip .month { font-size: 13px; }

  .table-cell .table-name { font-size: 15px; }
  .table-cell .table-cap { font-size: 12px; }

  /* PC 弹窗居中 */
  .modal {
    bottom: auto; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -50%);
    border-radius: 20px; width: 420px; max-height: 88vh;
    animation: none;
  }
  .modal-title { text-align: left; padding: 24px 28px 18px; }
  .modal-body { padding: 0 28px; }
  .btn-row { padding: 16px 28px 28px; position: static; }

  .form-row label { font-size: 14px; }
  .form-row input { padding: 14px 16px; font-size: 16px; }
  .option-chip { font-size: 15px; padding: 10px 20px; }
  .btn { font-size: 16px; padding: 14px 0; }

  .modal.center { width: 380px; }

  .my-section { padding: 28px; }
  .my-search input { font-size: 15px; }
}
/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
