:root {
  --bg: #fffaf5;
  --card: rgba(255,255,255,0.94);
  --line: #f1dcc9;
  --text: #2f241d;
  --muted: #7d6655;
  --primary: #ff7a45;
  --primary-dark: #ef5c1c;
  --danger: #d64545;
  --shadow: 0 12px 30px rgba(68, 36, 14, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fff7ef 0%, #fffdfb 100%);
  color: var(--text);
}
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.hero {
  display: grid;
  gap: 18px;
  margin-top: 6px;
}
.hero-copy { text-align: center; }
.eyebrow {
  color: var(--primary-dark);
  font-weight: 700;
  margin: 0 0 6px;
}
h1, h2, h3, p { margin-top: 0; }
.muted, small { color: var(--muted); }
.admin-grid, .picker-card {
  margin-top: 16px;
}
.admin-grid {
  display: grid;
  gap: 16px;
}
.card-subtle {
  border: 1px dashed var(--line);
  background: #fff8f2;
  border-radius: 16px;
  padding: 14px;
}
button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--primary);
  color: white;
}
button:hover { background: var(--primary-dark); }
.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.danger { background: var(--danger); }
select, input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 1rem;
  background: white;
}
.stack-form, .inline-form, .dish-form, .settings-form {
  display: grid;
  gap: 12px;
}
.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mode-option { position: relative; }
.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mode-option span {
  display: block;
  text-align: center;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  color: var(--text);
}
.mode-option input:checked + span {
  background: #fff0e8;
  border-color: #ffb08b;
  color: var(--primary-dark);
}
.canteen-extra {
  display: none;
}
.direct-picker {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 8px;
}
.main-pick-btn {
  padding: 16px;
  font-size: 1.06rem;
}
.scene-fab-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
}
.scene-fab {
  width: 56px;
  height: 56px;
  min-width: 56px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(68, 36, 14, 0.16);
  font-size: 0.95rem;
}
.scene-fab-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(320px, calc(100vw - 32px));
  display: none;
  gap: 10px;
  box-shadow: 0 14px 34px rgba(68, 36, 14, 0.18);
}
.scene-fab-panel.open {
  display: grid;
}
.scene-panel-head {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}
.scene-mode-picker {
  margin-top: 0;
}
.distance-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2f6aa1;
  font-size: 0.82rem;
  font-weight: 700;
}
.result-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.result-box {
  width: 100%;
  max-width: 560px;
  min-height: 172px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ff8c5a, #ffb36b);
  color: #fff;
  padding: 22px;
  display: grid;
  gap: 10px;
  align-content: center;
  text-align: center;
}
.result-box strong {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1.2;
}
.result-box small,
.result-box span {
  color: rgba(255,255,255,0.92);
}
.result-box-empty {
  background: linear-gradient(135deg, #ffd3bf, #ffc68f);
}
.result-box-animating {
  animation: resultPulse 0.55s ease-in-out infinite alternate;
}
.result-box-final {
  animation: resultPop 0.35s ease-out;
}
@keyframes resultPulse {
  from {
    transform: scale(0.985);
    box-shadow: 0 10px 24px rgba(255, 122, 69, 0.18);
  }
  to {
    transform: scale(1);
    box-shadow: 0 18px 36px rgba(255, 122, 69, 0.28);
  }
}
@keyframes resultPop {
  0% {
    transform: scale(0.98);
    filter: saturate(0.92);
  }
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}
.list-card { margin-top: 16px; }
.canteen-list {
  display: grid;
  gap: 12px;
}
.canteen-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.canteen-item ul {
  margin: 10px 0 0;
  padding-left: 18px;
}
.login-card {
  max-width: 480px;
  margin: 10vh auto 0;
}
.error { color: var(--danger); font-weight: 700; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.item-form { margin-top: 14px; }
.danger-row { margin: 8px 0 18px; }
.editable-row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.editable-row:last-child {
  border-bottom: 0;
}
.action-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.inline-status {
  font-size: 0.9rem;
  color: var(--primary-dark);
  min-height: 1.2em;
}
.weight-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff0e8;
  color: #b4542d;
  font-size: 0.82rem;
  font-weight: 700;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  min-height: 24px;
}
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.settings-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 10px;
}
.chart-block {
  display: grid;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.prob-pie {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.chart-legend {
  display: grid;
  gap: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}
.legend-item strong {
  margin-left: auto;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
}
.prob-grid {
  display: grid;
  gap: 14px;
}
.prob-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.prob-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.prob-badge {
  font-weight: 800;
  color: var(--primary-dark);
}
.prob-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #f4e7dc;
  overflow: hidden;
}
.prob-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8c5a, #ffb36b);
}
.settings-inline-row {
  display: flex;
  align-items: center;
}
@media (min-width: 768px) {
  .picker-card {
    max-width: 720px;
    margin: 16px auto 0;
  }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-block { grid-template-columns: 420px 1fr; }
  .inline-form { grid-template-columns: 1.1fr 1.2fr 120px auto; align-items: center; }
  .canteen-form { grid-template-columns: 1fr 1.2fr 100px 120px 220px 90px; align-items: center; }
  .dish-form { grid-template-columns: 1fr 1.2fr 180px 120px 220px 90px; align-items: center; }
}
