﻿:root {
  --primary: #ff6b35;
  --secondary: #ffc971;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text-main: #212529;
  --text-sub: #6c757d;
  --line: #e9ecef;
  --ok: #198754;
  --warn: #d9480f;
  --shadow: 0 20px 48px rgba(33, 37, 41, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 10% -20%, #ffdcb0 0%, transparent 40%),
    radial-gradient(circle at 100% 0, #ffe8c6 0, transparent 50%), var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

.app-bg {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 107, 53, 0.06), rgba(255, 201, 113, 0.03));
  pointer-events: none;
}

.app {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 86px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-sub);
}

.top-header h1 {
  font-size: clamp(24px, 4.5vw, 34px);
  line-height: 1.15;
}

.compat-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff4d8;
  color: #7a4e00;
  border-bottom: 1px solid #ffdca8;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
}

.share-landing {
  border-radius: 14px;
  border: 1px solid #ffd8b3;
  background: linear-gradient(120deg, #fff5ea, #fffaf4);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 14px;
}

.tab-panel {
  display: none;
  gap: 12px;
  flex-direction: column;
}

.tab-panel.active {
  display: flex;
}

.card-title-row,
.pool-head,
.row-between,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card h2,
.card h3 {
  font-size: 18px;
}

.sub {
  color: var(--text-sub);
  font-size: 13px;
}

.tiny {
  color: var(--text-sub);
  font-size: 12px;
  margin-top: 6px;
}

.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag-btn,
.tag-chip {
  border-radius: 999px;
  border: 1px solid #d0d7de;
  padding: 7px 13px;
  font-size: 14px;
}

.tag-btn {
  background: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.tag-btn:hover {
  transform: translateY(-1px);
}

.tag-btn.active {
  background: linear-gradient(110deg, var(--primary), #ff8f59);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.03);
}

.tag-chip {
  background: #fff7f2;
  border-color: #ffd8c2;
}

.pool-group {
  margin-top: 12px;
}

.pool-group h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.manual-tune label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.manual-tune input,
.chat-form input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #ced4da;
  padding: 11px 12px;
  background: #fff;
}

.manual-tune input:focus,
.chat-form input:focus {
  outline: 2px solid rgba(255, 107, 53, 0.25);
  border-color: var(--primary);
}

.primary-btn,
.ghost-btn,
.text-btn {
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(120deg, var(--primary), #ff8f59);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
}

.primary-btn.mini {
  padding: 6px 12px;
  font-size: 13px;
}

.ghost-btn {
  border: 1px solid #cfd4da;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
}

.text-btn {
  color: var(--text-sub);
  font-size: 14px;
}

.action-row {
  margin-top: 2px;
}

.hero-btn {
  width: 100%;
  padding: 14px;
  font-size: 17px;
}

.result-list-wrap {
  padding-bottom: 10px;
}

.result-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.dish-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.dish-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: blur(10px);
  transform: scale(1.03);
  transition: filter 0.28s ease, transform 0.28s ease;
}

.dish-card img.loaded {
  filter: blur(0);
  transform: scale(1);
}

.dish-card-body {
  padding: 12px;
}

.dish-card h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.meta-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.card-actions button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.card-actions .swap-btn {
  border: 1px solid #e6c1aa;
  background: #fff7f2;
}

.card-actions .open-btn {
  background: #222;
  color: #fff;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 62vh;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  padding: 10px;
  min-height: 45vh;
  max-height: 56vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: 88%;
  border-radius: 12px;
  padding: 10px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.user {
  align-self: flex-end;
  background: #ffe8d9;
}

.bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e7eaee;
}

.bubble .ratio {
  color: #087f5b;
  font-weight: 700;
  background: #e8fff8;
  border-radius: 6px;
  padding: 0 3px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(18, 18, 18, 0.55);
  display: flex;
  justify-content: center;
  align-items: end;
}

.detail-body {
  width: min(900px, 100vw);
  max-height: calc(100dvh - 64px);
  overflow: auto;
  border-radius: 22px 22px 0 0;
  background: #f6f7f8;
  padding: 14px 14px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-head {
  position: absolute;
  top: 10px;
  width: min(900px, calc(100vw - 20px));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.detail-head .ghost-btn,
.floating-timer {
  pointer-events: auto;
}

.floating-timer {
  background: #fff;
  border-radius: 999px;
  border: 1px solid #e2e4e7;
  box-shadow: var(--shadow);
  padding: 6px 8px;
}

.floating-timer button {
  cursor: pointer;
}

.timer-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d6d9dd;
  min-width: 170px;
}

#timer-display {
  font-size: 24px;
  font-weight: 700;
}

.timer-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.dish-figure {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.dish-figure img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.dish-figure figcaption {
  padding: 10px;
  font-size: 24px;
  font-weight: 700;
}

#ingredient-list li,
#tips-list li {
  position: relative;
  padding-left: 18px;
  margin-top: 8px;
}

#ingredient-list li::before,
#tips-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.step-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  border: 1px solid #e9ecef;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.step-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
}

.step-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.step-main {
  flex: 1;
}

.step-index {
  font-weight: 700;
  margin-right: 6px;
}

.step-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.step-actions button {
  border-radius: 999px;
  border: 1px solid #cfd4da;
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.chemistry-panel {
  margin-top: 8px;
  border-radius: 10px;
  background: #edf7ff;
  border: 1px solid #cfe8ff;
  padding: 8px;
  color: #245f8d;
  font-size: 13px;
}

.warning {
  margin-top: 8px;
  color: var(--warn);
}

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

.poster-canvas {
  width: 100%;
  max-width: 300px;
}

.poster-preview {
  margin-top: 10px;
  width: min(100%, 340px);
  border-radius: 14px;
  border: 1px solid #dce0e5;
}

.history-drawer {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: end;
}

.history-drawer > div {
  width: min(900px, 100vw);
}

.history-head {
  border-radius: 18px 18px 0 0;
  background: #fff;
  border-bottom: 1px solid #e8edf2;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  max-height: 62dvh;
  overflow: auto;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid #e8edf2;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: min(900px, calc(100vw - 20px));
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e8edf2;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  backdrop-filter: blur(10px);
}

.tab-btn {
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.tab-btn.active {
  background: linear-gradient(120deg, #ffe2d0, #fff2df);
  color: #9b3d13;
  font-weight: 600;
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid #ffd7c5;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  transform: translateX(-50%);
  bottom: 88px;
  background: rgba(33, 37, 41, 0.9);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  max-width: calc(100vw - 24px);
  text-align: center;
}

.empty-state {
  margin-top: 8px;
  border: 1px dashed #ddd;
  border-radius: 12px;
  padding: 12px;
  color: var(--text-sub);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .app {
    padding: 12px 12px 84px;
  }

  .result-list {
    grid-template-columns: 1fr;
  }

  .share-actions {
    flex-direction: column;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}
