:root {
  --ink: #22302b;
  --muted: #68756f;
  --panel: rgba(255, 255, 255, 0.88);
  --green: #159866;
  --green-dark: #086542;
  --empty: #fffdf3;
  --gold: #d8a83c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3e8;
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  padding: 11px 14px;
  font-weight: 700;
}

button:active {
  transform: translateY(1px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 14px 8px;
  background: linear-gradient(180deg, rgba(238, 243, 232, 0.96), rgba(238, 243, 232, 0.72));
  backdrop-filter: blur(10px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(20px, 5vw, 30px);
  line-height: 1.15;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.map-shell {
  height: calc(100vh - 132px);
  overflow: auto;
  padding: 8px 10px 96px;
  scroll-behavior: smooth;
}

.map-canvas {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(36, 46, 37, 0.2);
  transition: width 0.2s ease;
}

.map-shell.zoomed .map-canvas {
  width: 900px;
  max-width: none;
}

.map-bg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  user-select: none;
  pointer-events: none;
}

.seat-layer {
  position: absolute;
  inset: 0;
}

.seat {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 2px solid rgba(6, 86, 54, 0.84);
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  font-size: clamp(9px, 1.55vw, 16px);
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  touch-action: manipulation;
}

.seat.empty {
  background: rgba(255, 255, 245, 0.94);
  color: #59645e;
  border-color: rgba(116, 127, 121, 0.68);
}

.seat.focused,
.seat.grouped {
  outline: 3px solid #ffd45d;
  outline-offset: 2px;
  z-index: 2;
}

.actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
  background: rgba(238, 243, 232, 0.9);
  backdrop-filter: blur(12px);
}

.actions button {
  min-height: 46px;
  padding: 8px;
}

.overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.hidden {
  display: none !important;
}

.translucent {
  background: rgba(14, 22, 18, 0.3);
  padding: 76px 12px 84px;
}

.sheet {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sheet-head h2,
.modal-card h2 {
  font-size: 20px;
}

.ghost,
.secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid rgba(39, 56, 48, 0.16);
}

.search-box {
  margin-bottom: 10px;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(44, 61, 52, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid rgba(42, 58, 50, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.item-head,
.member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.item-head strong,
.member strong {
  display: block;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.members {
  border-top: 1px solid rgba(42, 58, 50, 0.1);
  padding: 6px;
}

.seat-pill {
  min-width: 42px;
  border-radius: 999px;
  background: rgba(21, 152, 102, 0.12);
  color: var(--green-dark);
  padding: 5px 8px;
  text-align: center;
  font-weight: 800;
}

.settings {
  overflow: auto;
  background: #f4f2e8;
  padding: 18px 12px 96px;
}

.settings-page {
  width: min(860px, 100%);
  margin: 0 auto;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.modal {
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 20, 16, 0.42);
}

.modal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 88vh;
  overflow: auto;
  display: grid;
  gap: 12px;
  border-radius: 16px;
  background: #fffdf6;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.modal-card.wide {
  width: min(760px, 100%);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: rgba(34, 48, 43, 0.08);
  color: var(--ink);
  font-size: 22px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.member-rows {
  display: grid;
  gap: 10px;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr 1fr 120px auto;
  gap: 8px;
  align-items: end;
}

.danger {
  background: #d94a38;
}

.error {
  min-height: 18px;
  color: #b73425;
  font-size: 13px;
}

@media (max-width: 640px) {
  .map-shell {
    height: calc(100vh - 126px);
    padding-inline: 8px;
  }

  .map-shell.zoomed .map-canvas {
    width: 860px;
  }

  .grid-two,
  .member-row {
    grid-template-columns: 1fr;
  }

  .member-row button {
    width: 100%;
  }
}
