:root {
  --bg: #f5fbfb;
  --bg-2: #e8f7f6;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-soft: #f7fcfc;
  --line: rgba(31, 183, 176, 0.16);
  --line-strong: rgba(31, 183, 176, 0.34);
  --text-main: #163438;
  --text-subtle: #4f6f73;
  --accent: #1eb7b0;
  --accent-strong: #128e88;
  --accent-soft: #def9f7;
  --ok: #0b9f6d;
  --error: #d94d5c;
  --shadow: 0 16px 45px rgba(18, 78, 80, 0.12);
  --shadow-strong: 0 22px 55px rgba(18, 78, 80, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(30, 183, 176, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(30, 183, 176, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  display: grid;
  place-items: center;
  padding: 0.9rem;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 75% 10%, rgba(30, 183, 176, 0.18), transparent 24%),
    radial-gradient(circle at 15% 85%, rgba(30, 183, 176, 0.14), transparent 22%);
}

.app-shell {
  width: min(860px, calc(100vw - 1rem));
  background: var(--surface);
  border: 1px solid rgba(30, 183, 176, 0.18);
  border-radius: 1.35rem;
  padding: 1rem;
  box-shadow: var(--shadow);
  position: relative;
  backdrop-filter: blur(14px);
  animation: rise-in 420ms ease;
}

.hero {
  padding: 0.4rem 0.2rem 0;
}

.hero h1 {
  margin: 0.1rem 0 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 800;
}

.subtitle {
  margin: 0.55rem 0 0;
  color: var(--text-subtle);
  max-width: 60ch;
}

.actions {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.action-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-soft));
  box-shadow: var(--shadow);
  padding: 1rem;
  min-height: 5.1rem;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.action-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(30, 183, 176, 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.action-card:hover,
.action-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-strong);
  outline: none;
}

.action-card:hover::after,
.action-card:focus-visible::after {
  opacity: 1;
}

.action-title {
  display: block;
  font-weight: 800;
  font-size: 1.05rem;
}

.action-text {
  display: block;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

.panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-soft));
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: slide-fade 220ms ease;
}

.hidden {
  display: none;
}

form {
  display: grid;
  gap: 0.7rem;
}

.address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
}

label {
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(30, 183, 176, 0.18);
  border-radius: 0.8rem;
  padding: 0.92rem 0.85rem;
  background: #fff;
  color: var(--text-main);
  min-height: 3rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input::placeholder {
  color: #7a9a9e;
}

input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(30, 183, 176, 0.22);
  border-color: var(--accent);
}

.primary,
.ghost,
.rate {
  border: none;
  border-radius: 0.85rem;
  min-height: 3rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.primary {
  margin-top: 0.25rem;
  padding: 0.95rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 26px rgba(30, 183, 176, 0.22);
}

.primary:hover:not(:disabled),
.primary:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
  outline: none;
}

.primary:disabled,
.rate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost {
  padding: 0.72rem 0.9rem;
  background: #fff;
  color: var(--accent-strong);
  border: 1px solid rgba(30, 183, 176, 0.22);
  box-shadow: 0 8px 18px rgba(18, 78, 80, 0.06);
}

.ghost:hover,
.ghost:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 20px rgba(18, 78, 80, 0.08);
  outline: none;
}

.address-row .ghost {
  white-space: nowrap;
}

.note {
  margin: 0.15rem 0 0;
  color: var(--text-subtle);
  font-size: 0.92rem;
  line-height: 1.5;
}

.room-header {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.8rem;
  flex-direction: column;
}

.room-heading-group {
  display: grid;
  gap: 0.15rem;
}

.room-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.room-header h2 {
  margin: 0.1rem 0 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  letter-spacing: -0.03em;
}

.room-meta {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.2rem;
}

.room-meta .note {
  margin: 0;
}

.deck-area {
  margin-top: 0.95rem;
  border: 1px solid rgba(30, 183, 176, 0.18);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(223, 249, 247, 0.7));
  padding: 0.9rem;
  min-height: 22rem;
}

.deck-stack {
  position: relative;
  height: 20rem;
}

.deck-card {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(30, 183, 176, 0.16);
  border-radius: 1rem;
  background: linear-gradient(180deg, #fff, #f4fffe);
  padding: 1rem;
  box-shadow: var(--shadow-strong);
  transform: translateY(calc(var(--stack-depth, 0) * 10px)) scale(calc(1 - var(--stack-depth, 0) * 0.035));
  z-index: calc(20 - var(--stack-depth, 0));
  transition: transform 200ms ease, opacity 200ms ease, box-shadow 200ms ease;
}

.deck-card h3 {
  margin: 0.25rem 0 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  font-size: clamp(1.15rem, 3.2vw, 1.45rem);
}

.card-cuisine {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-strong);
  font-weight: 800;
}

.card-address {
  margin-top: 0.45rem;
  color: var(--text-subtle);
}

.card-meta {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
  color: #24484b;
  font-size: 0.92rem;
}

.deck-photo-strip {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.deck-photo {
  width: 100%;
  height: 4.8rem;
  object-fit: cover;
  border-radius: 0.55rem;
  border: 1px solid rgba(30, 183, 176, 0.18);
  background: #e9f4f4;
}

.deck-card.top {
  cursor: grab;
  touch-action: pan-y;
}

.deck-card.top.dragging {
  cursor: grabbing;
}

.deck-card.exit-left {
  transform: translateX(-120%) rotate(-15deg);
  opacity: 0;
}

.deck-card.exit-right {
  transform: translateX(120%) rotate(15deg);
  opacity: 0;
}

.deck-card.deck-empty {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--text-subtle);
}

.deck-card.deck-empty h3 {
  margin: 0;
}

.deck-card.deck-empty p {
  margin: 0.55rem 0 0;
}

.deck-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.95rem;
}

.rate {
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(18, 78, 80, 0.12);
}

.rate:hover:not(:disabled),
.rate:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
  outline: none;
}

.rate-left {
  background: linear-gradient(135deg, #ff8a8a, #e55f6d);
}

.rate-right {
  background: linear-gradient(135deg, #34d1c8, #1eafaa);
}

.completed {
  margin-top: 0.95rem;
  border-top: 1px solid rgba(30, 183, 176, 0.18);
  padding-top: 0.9rem;
}

.completed h3 {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pick-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(30, 183, 176, 0.14);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 800;
}

.completed ol {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-subtle);
  line-height: 1.6;
}

.status {
  min-height: 1.2em;
  margin-top: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--error);
}

@keyframes rise-in {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-fade {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  body {
    place-items: start center;
    padding: 0.55rem;
  }

  .app-shell {
    width: min(100%, calc(100vw - 0.7rem));
    border-radius: 1.1rem;
    padding: 0.9rem;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .room-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost,
  .primary,
  .action-card,
  input,
  select,
  .rate {
    min-height: 3.2rem;
  }

  .ghost {
    width: 100%;
  }

  .address-row {
    grid-template-columns: 1fr;
  }

  .deck-area {
    min-height: 20.5rem;
  }

  .deck-stack {
    height: 18.6rem;
  }

}

@media (max-width: 460px) {
  .hero h1 {
    font-size: clamp(2rem, 10vw, 2.6rem);
  }

  .subtitle,
  .note {
    font-size: 0.93rem;
  }

  .panel {
    padding: 0.9rem;
  }

  .action-card {
    padding: 0.95rem;
  }

  .card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

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