:root {
  color-scheme: light;
  --ft-ink: #12313c;
  --ft-muted: #5d7280;
  --ft-line: #cfe1e6;
  --ft-panel: rgba(255, 255, 255, 0.92);
  --ft-panel-strong: #ffffff;
  --ft-teal: #159c9a;
  --ft-green: #55a646;
  --ft-yellow: #f9b83a;
  --ft-red: #dd4c45;
  --ft-blue: #2f83cc;
  --ft-shadow: 0 14px 34px rgba(28, 83, 92, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ft-ink);
  background:
    linear-gradient(180deg, rgba(230, 250, 250, 0.92), rgba(255, 247, 224, 0.92)),
    #e8f5f2;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

[hidden] {
  display: none !important;
}

.ft-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #dff8f5, #fff5d6);
  z-index: 20;
}

.ft-loading-card {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 28px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--ft-shadow);
  text-align: center;
}

.ft-loading-mark {
  font-size: 44px;
}

.ft-loading-card span {
  color: var(--ft-muted);
}

.ft-app {
  width: min(1820px, calc(100vw - 24px));
  height: calc(100dvh - 16px);
  min-height: 0;
  margin: 8px auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ft-app[data-phase="lobby"],
.ft-app[data-phase="countdown"],
.ft-app[data-phase="waiting"] {
  grid-template-rows: minmax(0, 1fr);
}

.ft-topbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.ft-brand,
.ft-metric,
.ft-panel {
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  background: var(--ft-panel);
  box-shadow: var(--ft-shadow);
}

.ft-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 10px 14px;
}

.ft-eyebrow,
.ft-kicker {
  color: var(--ft-teal);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ft-brand h1 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2vw, 2.1rem);
  line-height: 1.05;
}

.ft-sound-toggle {
  align-self: center;
  margin-left: auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #badbdc;
  border-radius: 8px;
  background: #eef8f8;
  color: #0f6e70;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.ft-sound-toggle:hover,
.ft-sound-toggle:focus-visible {
  border-color: var(--ft-teal);
  background: #ddf3f3;
  outline: none;
}

.ft-sound-toggle[aria-pressed="false"] {
  border-color: #d6dde0;
  background: #eef2f3;
  color: var(--ft-muted);
}

.ft-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.ft-metric {
  min-width: 0;
  padding: 12px 14px;
}

.ft-metric span {
  display: block;
  color: var(--ft-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.ft-metric strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1rem, 1.4vw, 1.45rem);
  line-height: 1.1;
  white-space: nowrap;
}

.ft-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.ft-app[data-phase="business"] .ft-layout,
.ft-app[data-phase="question"][data-view="kitchen"] .ft-layout {
  grid-template-columns: minmax(0, 1fr);
  overflow: visible;
}

.ft-app[data-phase="business"] .ft-stage,
.ft-app[data-phase="business"] .ft-panels,
.ft-app[data-phase="question"][data-view="kitchen"] .ft-stage,
.ft-app[data-phase="question"][data-view="kitchen"] .ft-panels {
  min-height: auto;
  overflow: visible;
}

.ft-app[data-phase="business"] .ft-kitchen,
.ft-app[data-phase="question"][data-view="kitchen"] .ft-kitchen {
  grid-template-rows: auto auto auto auto;
  overflow: visible;
}

.ft-app[data-phase="question"] .ft-layout,
.ft-app[data-phase="finished"] .ft-layout {
  grid-template-columns: minmax(0, 1fr);
}

.ft-app[data-phase="question"] .ft-rankbar,
.ft-app[data-phase="business"] .ft-rankbar {
  display: none;
}

.ft-app[data-phase="question"][data-view="question"] .ft-kitchen,
.ft-app[data-phase="question"][data-view="question"] .ft-sidebar,
.ft-app[data-phase="question"][data-view="kitchen"] .ft-question,
.ft-app[data-phase="business"] .ft-question,
.ft-app[data-phase="finished"] .ft-stage,
.ft-app[data-phase="finished"] .ft-sidebar {
  display: none;
}

.ft-app[data-phase="question"] .ft-panels,
.ft-app[data-phase="business"] .ft-panels {
  grid-template-columns: minmax(0, 1fr);
}

.ft-app[data-phase="question"][data-view="question"] .ft-question {
  width: min(980px, 100%);
  margin: 0 auto;
}

.ft-result-panel {
  display: none;
}

.ft-app[data-phase="finished"] .ft-result-panel {
  display: grid;
}

.ft-stage {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ft-waiting-screen {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #badbe0;
  border-radius: 8px;
  background: #bde9e8;
  box-shadow: var(--ft-shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.58fr);
  align-items: end;
  padding: clamp(22px, 4vw, 52px);
}

.ft-waiting-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ft-waiting-truck {
  position: absolute;
  left: clamp(12px, 4vw, 64px);
  bottom: clamp(-16px, -2vw, -6px);
  width: min(43vw, 540px);
  max-height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 20px 22px rgba(27, 64, 67, 0.2));
}

.ft-waiting-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 250, 232, 0.92) 54%, rgba(255, 255, 255, 0.96));
}

.ft-waiting-content {
  position: relative;
  z-index: 1;
  grid-column: 2;
  display: grid;
  gap: 14px;
  padding: clamp(16px, 2.5vw, 28px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  font-weight: 800;
}

.ft-waiting-content h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3.5vw, 3.25rem);
  line-height: 1.05;
}

.ft-waiting-content p {
  margin: 0;
  color: var(--ft-muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.ft-waiting-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ft-waiting-rules div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #d6e8e8;
  border-radius: 8px;
  background: #fff;
}

.ft-waiting-rules strong {
  color: #0f766e;
}

.ft-waiting-rules span {
  color: var(--ft-muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.ft-round {
  color: #0c7774;
  font-size: 0.82rem;
  font-weight: 900;
}

.ft-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.ft-flow-step {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ft-muted);
  font-weight: 900;
}

.ft-flow-step span {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e7f1f4;
  color: var(--ft-teal);
}

.ft-flow-step.active {
  border-color: #80c8be;
  background: #e6fbf4;
  color: var(--ft-ink);
}

.ft-panels {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
  gap: 12px;
  min-height: 0;
}

.ft-panel {
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.ft-kitchen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0;
}

.ft-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ft-panel h2 {
  margin: 2px 0 0;
  font-size: 1.02rem;
  line-height: 1.15;
}

.ft-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef8f8;
  color: #0f6e70;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.ft-question-text {
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 18px;
  border: 1px solid #d5e3e7;
  border-radius: 8px;
  background: #fff;
  font-size: clamp(1rem, 1.45vw, 1.45rem);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.ft-question-media {
  width: 100%;
  max-height: min(360px, 42dvh);
  margin-top: 10px;
  object-fit: contain;
  border-radius: 8px;
  background: #f6fbfb;
  cursor: zoom-in;
  outline: 0;
}

.ft-question-media:focus-visible {
  box-shadow: 0 0 0 4px rgba(47, 131, 204, 0.22);
}

.ft-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ft-option,
.ft-short-answer button,
.ft-action-row button,
.ft-buy-btn,
.ft-tray-btn,
.ft-serve-btn,
.ft-growth-open-btn,
.ft-growth-action {
  min-height: 46px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ft-option:nth-child(4n+1) { background: var(--ft-blue); }
.ft-option:nth-child(4n+2) { background: var(--ft-green); }
.ft-option:nth-child(4n+3) { background: var(--ft-yellow); color: #583b00; }
.ft-option:nth-child(4n) { background: var(--ft-red); }

.ft-short-answer {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  margin-top: 12px;
}

.ft-short-answer input {
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
}

.ft-short-answer button,
.ft-action-row button {
  background: var(--ft-teal);
}

.ft-kitchen-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.ft-feedback {
  min-height: 28px;
  margin-top: 10px;
  color: var(--ft-muted);
  font-weight: 800;
}

.ft-market {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.ft-ingredient-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  align-items: stretch;
  min-height: 64px;
  padding: 5px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ft-ingredient-card.ft-needed {
  border-color: #f3b33c;
  background: #fffaf0;
}

.ft-ingredient-card.ft-missing {
  border-color: #dd4c45;
}

.ft-ingredient-card.ft-tray-covered {
  border-color: #47ad7f;
  background: #f1fff8;
}

.ft-ingredient-card.ft-flash {
  animation: ftIngredientPulse 0.72s ease-in-out 0s 2;
}

.ft-action-fx {
  animation: ftActionPop 0.64s ease-in-out 0s 1;
}

.ft-metric-fx,
.ft-chip-fx,
.ft-craft-btn-fx {
  animation: ftValuePop 0.68s ease-out 0s 1;
}

.ft-dish.ft-craft-fx {
  border-color: #f3b33c;
  background: #fff8df;
  animation: ftCookPop 0.72s ease-out 0s 1;
}

.ft-orders-list.ft-serve-fx {
  animation: ftServeSweep 0.72s ease-out 0s 1;
}

.ft-growth-card.ft-recipe-fx,
.ft-growth-card.ft-upgrade-fx {
  border-color: var(--ft-teal);
  background: #effdfb;
}

.ft-ingredient-card-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.ft-need-badge {
  grid-column: 1 / -1;
  display: inline-flex;
  justify-content: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff0bf;
  color: #7b4a00;
  font-size: 0.74rem;
  font-weight: 900;
}

.ft-missing .ft-need-badge {
  background: #ffe1df;
  color: #a72923;
}

.ft-tray-covered .ft-need-badge {
  background: #dff9eb;
  color: #11613d;
}

@keyframes ftIngredientPulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 rgba(249, 184, 58, 0);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(249, 184, 58, 0.28);
  }
}

@keyframes ftActionPop {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(21, 156, 154, 0);
  }
  42% {
    transform: scale(1.025);
    box-shadow: 0 0 0 4px rgba(21, 156, 154, 0.22);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(21, 156, 154, 0);
  }
}

@keyframes ftValuePop {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(243, 179, 60, 0);
  }
  45% {
    transform: translateY(-2px) scale(1.035);
    box-shadow: 0 0 0 5px rgba(243, 179, 60, 0.22);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(243, 179, 60, 0);
  }
}

@keyframes ftCookPop {
  0% {
    transform: translateY(4px) scale(0.98);
    box-shadow: 0 0 0 rgba(243, 179, 60, 0);
  }
  48% {
    transform: translateY(-3px) scale(1.035);
    box-shadow: 0 0 0 7px rgba(243, 179, 60, 0.24);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(243, 179, 60, 0);
  }
}

@keyframes ftServeSweep {
  0% {
    box-shadow: inset 0 0 0 rgba(21, 156, 154, 0);
  }
  38% {
    box-shadow: inset 0 0 0 4px rgba(21, 156, 154, 0.2);
  }
  100% {
    box-shadow: inset 0 0 0 rgba(21, 156, 154, 0);
  }
}

@keyframes ftUrgentOrder {
  0%, 100% {
    transform: translateX(0);
    box-shadow: 0 0 0 rgba(221, 76, 69, 0);
  }
  34% {
    transform: translateX(-2px);
    box-shadow: 0 0 0 4px rgba(221, 76, 69, 0.2);
  }
  68% {
    transform: translateX(2px);
    box-shadow: 0 0 0 6px rgba(221, 76, 69, 0.12);
  }
}

@keyframes ftReadyPulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(85, 166, 70, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(85, 166, 70, 0.2);
  }
}

.ft-buy-btn,
.ft-tray-btn,
.ft-growth-open-btn,
.ft-growth-action,
.ft-serve-btn {
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 7px 8px;
  background: #fff;
  border: 1px solid var(--ft-line);
  color: var(--ft-ink);
  box-shadow: none;
  text-align: center;
}

.ft-buy-btn strong,
.ft-growth-open-btn strong {
  font-size: 0.9rem;
}

.ft-buy-btn span,
.ft-growth-open-btn span {
  color: var(--ft-muted);
  font-size: 0.72rem;
}

.ft-buy-btn:hover,
.ft-tray-btn:hover,
.ft-growth-open-btn:hover,
.ft-serve-btn:hover {
  border-color: #65b8b4;
  background: #f0fffb;
}

.ft-growth-open-btn.ready {
  border-color: #87c779;
  background: #f2fff0;
  color: #256b23;
  animation: ftReadyPulse 1.4s ease-in-out infinite;
}

.ft-buy-btn:active,
.ft-tray-btn:active,
.ft-growth-open-btn:active,
.ft-growth-action:active,
.ft-serve-btn:active,
.ft-empty-action:active,
.ft-action-row button:active,
.ft-option:active {
  transform: translateY(1px);
}

.ft-craft-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.ft-subhead {
  margin-bottom: 7px;
  color: var(--ft-muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.ft-tray,
.ft-dishes,
.ft-orders-list,
.ft-rank-list,
.ft-log-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.ft-tray,
.ft-dishes {
  min-height: 86px;
  align-content: start;
  padding: 8px;
  border: 1px dashed #bdd5da;
  border-radius: 8px;
  background: #f8fcfc;
}

.ft-dishes {
  min-height: 0;
  max-height: 142px;
}

.ft-token,
.ft-dish,
.ft-order,
.ft-rank-row,
.ft-log-row {
  border: 1px solid #d8e6e8;
  border-radius: 8px;
  background: #fff;
}

.ft-token,
.ft-dish {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 6px 8px;
  font-weight: 900;
}

.ft-token {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ft-dish-more {
  justify-content: center;
  border-style: dashed;
  color: var(--ft-muted);
  background: #f4fafb;
}

.ft-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.ft-action-row .ghost {
  background: #eaf2f4;
  color: var(--ft-ink);
}

.ft-sidebar {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ft-sidebar .ft-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.ft-service-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d8e6e8;
}

.ft-service-head {
  margin-bottom: 0;
}

.ft-service-area .ft-orders-list {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px 6px 0;
}

.ft-order {
  flex: 0 0 min(270px, 76vw);
  padding: 10px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ft-order.selected {
  border-color: #f3b33c;
  background: #fffaf0;
}

.ft-order.leaving-soon {
  border-color: #e85b4f;
  background: #fff2ef;
  animation: ftUrgentOrder 0.92s ease-in-out infinite;
}

.ft-order-empty {
  flex: 1 0 min(280px, 86vw);
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border: 1px dashed #b9d5d9;
  border-radius: 8px;
  background: #f8fcfc;
  color: #446066;
}

.ft-order-empty strong {
  color: #163640;
  font-size: 0.95rem;
}

.ft-order-empty span {
  font-size: 0.82rem;
  font-weight: 800;
}

.ft-empty-action {
  width: fit-content;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #1f7f6d;
  color: #fff;
  font-weight: 1000;
  cursor: pointer;
  touch-action: manipulation;
}

.ft-empty-action:disabled {
  background: #b6c7ca;
  color: #eef6f7;
  cursor: not-allowed;
}

.ft-order-head,
.ft-rank-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ft-order-name,
.ft-rank-row strong {
  font-weight: 900;
}

.ft-order-head strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ft-order-warning {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffe0dc;
  color: #a72923;
  font-size: 0.68rem;
  font-weight: 900;
  box-shadow: 0 0 0 2px rgba(232, 91, 79, 0.14);
}

.ft-order-items {
  margin-top: 5px;
  color: var(--ft-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.ft-order-needs,
.ft-recipe-needs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.ft-need-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid #d7e8e8;
  background: #fff;
  color: var(--ft-muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.ft-need-chip b {
  color: inherit;
  font-weight: 900;
}

.ft-need-chip.ready {
  border-color: #9dd7c2;
  background: #effbf5;
  color: #0f6844;
}

.ft-need-chip.tray {
  border-color: #64bc8e;
  background: #dff9eb;
  color: #0f5f3a;
}

.ft-need-chip.missing {
  border-color: #e7a29d;
  background: #fff0ee;
  color: #a72923;
}

.ft-serve-btn {
  width: 100%;
  margin-top: 8px;
  background: #e9f7f5;
}

.ft-rank-row {
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
}

.ft-rank-row.me {
  border-color: #7ec6b8;
  background: #eafff8;
}

.ft-rank-score {
  color: #0f766e;
  font-weight: 900;
}

.ft-log-row {
  padding: 8px 10px;
  color: var(--ft-muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.ft-result-panel {
  min-height: 0;
  gap: 12px;
  overflow: hidden;
}

.ft-result-hero {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #effbf5);
  box-shadow: var(--ft-shadow);
}

.ft-result-hero h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.6rem);
  line-height: 1.05;
}

.ft-result-hero p {
  margin: 0;
  color: var(--ft-muted);
  font-weight: 900;
}

.ft-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
  min-height: 0;
}

.ft-result-top5,
.ft-result-stats {
  display: grid;
  gap: 8px;
}

.ft-result-panel .rank-list {
  display: grid;
  gap: 8px;
}

.ft-result-panel .rank-row,
.ft-result-panel .rank-my-card {
  display: grid;
  align-items: center;
  min-height: 52px;
  border: 1px solid #d8e6e8;
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.ft-result-panel .rank-row {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 9px 12px;
}

.ft-result-panel .rank-row.me,
.ft-result-panel .rank-my-card {
  border-color: #7ec6b8;
  background: #eafff8;
}

.ft-result-panel .rank-no {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 30px;
  border-radius: 999px;
  background: #fff0bf;
  color: #7b4a00;
}

.ft-result-panel .rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ft-result-panel .rank-score,
.ft-result-panel .rank-my-score {
  color: #0f766e;
}

.ft-result-panel .rank-my-card {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 9px 12px;
}

.ft-result-panel .rank-my-card span {
  color: var(--ft-muted);
}

.ft-result-panel .rank-my-rank {
  color: var(--ft-ink);
}

.ft-result-rank,
.ft-result-stat {
  display: grid;
  align-items: center;
  min-height: 48px;
  border: 1px solid #d8e6e8;
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.ft-result-rank {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px;
}

.ft-result-rank.me {
  border-color: #7ec6b8;
  background: #eafff8;
}

.ft-result-medal {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #fff0bf;
  color: #7b4a00;
}

.ft-result-stat {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 9px 11px;
}

.ft-result-stat span {
  color: var(--ft-muted);
}

.ft-result-stat strong,
.ft-result-rank b {
  color: #0f766e;
}

body.ft-modal-open {
  overflow: hidden;
}

.ft-growth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 24;
}

.ft-growth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 38, 47, 0.48);
}

.ft-growth-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(860px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 14px;
  border: 1px solid #9ecfd2;
  border-radius: 8px;
  background: #f8ffff;
  box-shadow: 0 22px 54px rgba(11, 48, 58, 0.24);
}

.ft-growth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d8e6e8;
}

.ft-growth-modal-head h2 {
  margin: 2px 0 0;
}

.ft-growth-close {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #c7dadd;
  border-radius: 8px;
  background: #fff;
  color: var(--ft-ink);
  font-weight: 900;
}

.ft-growth-modal-body {
  min-height: 0;
  overflow-y: auto;
  padding-top: 12px;
}

.ft-growth-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ft-growth-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 11px;
  border: 1px solid #d8e6e8;
  border-radius: 8px;
  background: #fff;
}

.ft-growth-card.unlocked {
  border-color: #9dd7c2;
  background: #f3fff8;
}

.ft-growth-card.selected {
  border-color: #f3b33c;
  background: #fffaf0;
}

.ft-growth-card.maxed {
  background: #f7fbfc;
}

.ft-growth-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ft-growth-card-head strong {
  font-weight: 900;
}

.ft-growth-card-head span,
.ft-growth-meta {
  color: var(--ft-muted);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.32;
}

.ft-growth-action {
  min-height: 38px;
  border: 0;
  background: var(--ft-teal);
  color: #fff;
  font-size: 0.82rem;
}

.ft-growth-action.ghost {
  border: 1px solid #9dd7c2;
  background: #fff;
  color: var(--ft-ink);
}

.ft-growth-action:hover {
  filter: brightness(0.98);
}

.ft-growth-action.ghost:hover {
  background: #f0fffb;
}

.ft-growth-action:disabled {
  opacity: 0.58;
}

.ft-image-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 26;
}

.ft-image-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 38, 47, 0.62);
}

.ft-image-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, calc(100vw - 28px));
  max-height: min(840px, calc(100dvh - 28px));
  padding: 12px;
  border: 1px solid #9ecfd2;
  border-radius: 8px;
  background: #f8ffff;
  box-shadow: 0 22px 54px rgba(11, 48, 58, 0.28);
}

.ft-image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d8e6e8;
}

.ft-image-modal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.ft-image-close {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #c7dadd;
  border-radius: 8px;
  background: #fff;
  color: var(--ft-ink);
  font-weight: 900;
}

.ft-image-dialog img {
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 124px);
  margin-top: 12px;
  object-fit: contain;
  border-radius: 8px;
  background: #f0f8f8;
}

.ft-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  min-width: min(360px, calc(100vw - 32px));
  max-width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, 16px);
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(18, 49, 60, 0.94);
  color: #fff;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}

.ft-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1240px) {
  .ft-layout {
    grid-template-columns: 1fr;
  }

  .ft-app[data-phase="question"] .ft-layout,
  .ft-app[data-phase="finished"] .ft-layout {
    grid-template-columns: 1fr;
  }

  .ft-rankbar {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 920px) {
  .ft-app {
    width: min(100vw - 12px, 760px);
    margin: 6px auto;
  }

  .ft-topbar,
  .ft-layout,
  .ft-panels,
  .ft-rankbar,
  .ft-result-grid,
  .ft-waiting-rules {
    grid-template-columns: 1fr;
  }

  .ft-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ft-metric:last-child {
    grid-column: 1 / -1;
  }

  .ft-waiting-screen {
    grid-template-columns: 1fr;
    align-items: end;
    padding: 16px;
  }

  .ft-waiting-truck {
    width: min(78vw, 360px);
    max-height: 46%;
  }

  .ft-waiting-screen::after {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.94) 42%, rgba(255, 250, 232, 0.96));
  }

  .ft-waiting-content {
    grid-column: 1;
  }

  .ft-market {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ft-growth-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .ft-brand {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .ft-sound-toggle {
    margin-left: 0;
  }

  .ft-metrics,
  .ft-flow,
  .ft-options,
  .ft-craft-area,
  .ft-action-row,
  .ft-market,
  .ft-kitchen-actions {
    grid-template-columns: 1fr;
  }

  .ft-kitchen-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 720px) and (max-width: 1366px) {
  .ft-app {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    margin: 6px auto;
  }

  .ft-topbar {
    grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .ft-brand,
  .ft-metric,
  .ft-panel {
    box-shadow: 0 8px 18px rgba(28, 83, 92, 0.11);
  }

  .ft-brand {
    padding: 8px 10px;
  }

  .ft-brand h1 {
    font-size: 1.28rem;
  }

  .ft-sound-toggle {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  .ft-metrics {
    gap: 6px;
  }

  .ft-metric {
    padding: 7px 8px;
  }

  .ft-metric span {
    font-size: 0.67rem;
  }

  .ft-metric strong {
    margin-top: 2px;
    font-size: 0.94rem;
  }

  .ft-layout,
  .ft-panels,
  .ft-sidebar,
  .ft-rankbar {
    gap: 8px;
  }

  .ft-panel {
    padding: 9px;
  }

  .ft-panel-head {
    margin-bottom: 7px;
  }

  .ft-panel h2 {
    font-size: 0.92rem;
  }

  .ft-chip {
    min-height: 24px;
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  .ft-flow {
    gap: 6px;
    margin: 8px 0;
  }

  .ft-flow-step {
    height: 34px;
    gap: 6px;
    font-size: 0.82rem;
  }

  .ft-flow-step span {
    width: 21px;
    height: 21px;
  }

  .ft-question-text {
    min-height: 74px;
    padding: 10px;
    font-size: 0.98rem;
  }

  .ft-question-media {
    max-height: min(300px, 36dvh);
    margin-top: 6px;
  }

  .ft-options,
  .ft-short-answer {
    gap: 6px;
    margin-top: 8px;
  }

  .ft-option,
  .ft-short-answer button,
  .ft-action-row button,
  .ft-buy-btn,
  .ft-tray-btn,
  .ft-serve-btn,
  .ft-growth-open-btn,
  .ft-growth-action {
    min-height: 40px;
    padding: 5px 7px;
    font-size: 0.76rem;
  }

  .ft-feedback {
    min-height: 22px;
    margin-top: 6px;
    font-size: 0.76rem;
  }

  .ft-market {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .ft-ingredient-card {
    min-height: 52px;
    padding: 5px;
    gap: 4px;
    font-size: 0.78rem;
  }

  .ft-ingredient-card-header {
    font-size: 0.78rem;
  }

  .ft-need-badge {
    min-height: 18px;
    padding: 2px 6px;
    font-size: 0.66rem;
  }

  .ft-craft-area {
    gap: 8px;
    margin-top: 8px;
  }

  .ft-subhead {
    margin-bottom: 5px;
    font-size: 0.72rem;
  }

  .ft-tray,
  .ft-dishes {
    min-height: 56px;
    padding: 6px;
  }

  .ft-dishes {
    max-height: 106px;
  }

  .ft-token,
  .ft-dish {
    min-height: 28px;
    padding: 5px 7px;
    font-size: 0.76rem;
  }

  .ft-service-area {
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
  }

  .ft-order {
    padding: 7px;
  }

  .ft-order-items,
  .ft-log-row {
    font-size: 0.74rem;
  }

  .ft-serve-btn {
    margin-top: 5px;
  }

  .ft-rank-row {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .ft-log-row {
    padding: 6px 8px;
  }

  .ft-growth-dialog {
    padding: 10px;
  }

  .ft-growth-list {
    gap: 8px;
  }

  .ft-waiting-screen {
    padding: 12px;
  }

  .ft-waiting-truck {
    width: min(42vw, 280px);
  }

  .ft-waiting-content {
    gap: 8px;
    padding: 12px;
  }

  .ft-waiting-content h2 {
    font-size: 1.5rem;
  }

  .ft-waiting-content p,
  .ft-waiting-rules span {
    font-size: 0.78rem;
  }

  .ft-rank-list .ft-rank-row:nth-child(n+6),
  .ft-log-list .ft-log-row:nth-child(n+5) {
    display: none;
  }
}

@media (min-width: 720px) and (max-width: 1366px) and (orientation: landscape) {
  .ft-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ft-app[data-phase="business"] .ft-layout,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ft-app[data-phase="question"] .ft-layout,
  .ft-app[data-phase="finished"] .ft-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ft-panels {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }

  .ft-app[data-phase="business"] .ft-market,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-market {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .ft-app[data-phase="business"] .ft-ingredient-card,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-ingredient-card {
    min-height: 46px;
    padding: 4px;
    gap: 3px;
    font-size: 0.72rem;
  }

  .ft-app[data-phase="business"] .ft-ingredient-card-header,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-ingredient-card-header {
    gap: 5px;
    font-size: 0.72rem;
  }

  .ft-app[data-phase="business"] .ft-need-badge,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-need-badge {
    min-height: 16px;
    padding: 1px 5px;
    font-size: 0.61rem;
  }

  .ft-app[data-phase="business"] .ft-buy-btn,
  .ft-app[data-phase="business"] .ft-tray-btn,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-buy-btn,
  .ft-app[data-phase="question"][data-view="kitchen"] .ft-tray-btn {
    min-height: 36px;
    padding: 4px 5px;
    font-size: 0.7rem;
    line-height: 1.05;
  }
}

@media (min-width: 720px) and (max-width: 1366px) and (orientation: portrait) {
  .ft-topbar {
    grid-template-columns: 1fr;
  }

  .ft-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .ft-metric:last-child {
    grid-column: auto;
  }

  .ft-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 136px;
  }

  .ft-app[data-phase="question"] .ft-layout,
  .ft-app[data-phase="finished"] .ft-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .ft-stage {
    grid-column: 1;
    grid-row: 1;
  }

  .ft-rankbar {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
  }

  .ft-panels {
    grid-template-columns: 1fr;
  }

  .ft-market {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ft-waiting-screen {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .ft-waiting-content {
    grid-column: 1;
  }
}
