/* ═══ River Stone Palette ═══ */
:root {
  --bg: #F3F1EE;
  --card: #FFFFFF;
  --steel: #6B7B86;
  --deep-blue: #2B5C7A;
  --mid-blue: #4A8BAD;
  --light-blue: #7DB8D4;
  --orange: #D4652B;
  --text: #2A2E32;
  --subtle: #7B8088;
  --border: #DDD8D2;
  --input-bg: #EEECEA;
  --amber: #C9A96E;
  --cancel: #A85454;
  --shadow: 0 2px 8px rgba(42,46,50,0.07);
}

/* ═══ Reset ═══ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; }
input, textarea, select, button { font-family: inherit; outline: none; }
::-webkit-scrollbar { display: none; }

@media (min-width: 601px) {
  body { padding: 20px 0; }
  #root > div { border-radius: 16px; box-shadow: 0 4px 24px rgba(42,46,50,0.08); border: 1px solid var(--border); overflow: hidden; }
}

/* ═══ App Shell ═══ */
.app { background: var(--bg); min-height: 100vh; color: var(--text); max-width: 480px; margin: 0 auto; padding-bottom: 30px; }
.app.wide { max-width: 680px; }

/* ═══ Header ═══ */
.header { text-align: center; padding: 20px 16px 2px; }
.header h1 { font-size: 24px; font-weight: 800; color: var(--deep-blue); letter-spacing: 0.3px; margin: 0; }
.header .subtitle { font-size: 12px; color: var(--orange); margin: 3px 0 0; letter-spacing: 1.5px; font-style: italic; }
.header-actions { display: flex; justify-content: center; gap: 16px; margin-top: 6px; flex-wrap: wrap; }
.header-btn { background: none; border: none; color: var(--subtle); font-size: 12px; cursor: pointer; opacity: 0.7; }
.header-btn:hover { opacity: 1; }
.header-btn.accent { color: var(--deep-blue); font-weight: 600; opacity: 0.85; }

/* ═══ Tabs ═══ */
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tab { padding: 10px 13px; font-size: 12px; font-weight: 400; color: var(--subtle); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.tab.active { font-weight: 700; color: var(--deep-blue); border-bottom-color: var(--deep-blue); }

/* ═══ Sort Bar ═══ */
.sort-bar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; flex-wrap: wrap; }
.sort-label { font-size: 11px; color: var(--subtle); }
.sort-btn { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--subtle); cursor: pointer; font-weight: 400; }
.sort-btn.active { border-color: var(--deep-blue); background: rgba(43,92,122,0.08); color: var(--deep-blue); font-weight: 600; }

/* ═══ Cards ═══ */
.card { background: var(--card); border-radius: 12px; padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); border-left: 3px solid var(--steel); transition: transform 0.15s; }
.card:hover { transform: translateY(-1px); }
.card.v60 { border-left-color: var(--deep-blue); }
.card.chemex { border-left-color: var(--orange); }
.card.kalita { border-left-color: var(--amber); }
.card.melitta { border-left-color: var(--steel); }
.card-list { padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.card-list.grid { display: grid; grid-template-columns: 1fr 1fr; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.card-credit { font-size: 12px; color: var(--subtle); margin: 2px 0 0; }
.card-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.pill { background: var(--input-bg); padding: 3px 7px; border-radius: 6px; font-size: 11px; color: var(--steel); border: 1px solid var(--border); }
.pill.ratio { background: rgba(43,92,122,0.08); color: var(--deep-blue); border-color: rgba(43,92,122,0.2); font-weight: 600; }
.pill.brewer { background: rgba(212,101,43,0.08); color: var(--orange); border-color: rgba(212,101,43,0.2); font-weight: 600; }
.brewer-icon { font-size: 13px; color: var(--mid-blue); margin-right: 4px; font-weight: 700; }

/* ═══ Star / Favorite ═══ */
.star-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--border); padding: 0; line-height: 1; }
.star-btn.on { color: var(--orange); }
.star-sm { font-size: 14px; }
.star-lg { font-size: 32px; margin: 0 4px; }
.rating-row .star-btn { color: var(--border); }
.rating-row .star-btn.on { color: var(--amber); }

/* ═══ Panel (Welcome, Settings, Auth) ═══ */
.panel { padding: 0 16px 6px; }
.panel-box { background: var(--card); border-radius: 14px; padding: 18px 16px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.panel-text { color: var(--text); font-size: 14px; line-height: 1.7; margin: 0; font-weight: 500; }
.panel-muted { color: var(--subtle); font-size: 13px; line-height: 1.7; margin: 0; }
.panel-divider { width: 40px; height: 2px; background: var(--orange); margin: 12px 0; border-radius: 1px; }
.panel-dismiss { background: none; border: none; color: var(--deep-blue); font-size: 13px; cursor: pointer; padding: 8px 0 0; font-weight: 600; }
.close-btn { background: none; border: none; color: var(--subtle); cursor: pointer; font-size: 18px; }

/* ═══ Inputs ═══ */
.input { background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px; width: 100%; box-sizing: border-box; }
.input:focus { border-color: var(--mid-blue); }
.select { background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px; width: 100%; box-sizing: border-box; }
.label { font-size: 12px; color: var(--subtle); margin-bottom: 4px; display: block; }

/* ═══ Buttons ═══ */
.btn-primary { background: linear-gradient(135deg, var(--deep-blue), var(--orange)); color: #fff; border: none; border-radius: 10px; padding: 16px 0; font-size: 18px; font-weight: 700; width: 100%; cursor: pointer; margin-top: 12px; letter-spacing: 0.5px; }
.btn-primary:hover { opacity: 0.95; }
.btn-primary:disabled { opacity: 0.5; }
.btn-cancel { background: var(--cancel); color: #fff; border: none; border-radius: 10px; padding: 12px 24px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-sec { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.btn-sec:hover { border-color: var(--mid-blue); }

/* ═══ Detail View ═══ */
.detail { padding: 14px; }
.back-btn { background: none; border: none; color: var(--deep-blue); font-size: 14px; cursor: pointer; padding: 0; margin-bottom: 12px; }
.detail-title { color: var(--text); margin: 0; font-size: 22px; font-weight: 700; flex: 1; }
.detail-credit { color: var(--subtle); font-size: 13px; margin: 2px 0 16px; }
.stats-box { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px; border-top: 3px solid var(--deep-blue); box-shadow: var(--shadow); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.stat-label { font-size: 11px; color: var(--subtle); margin-bottom: 2px; }
.stat-value { font-size: 14px; font-weight: 600; color: var(--deep-blue); }
.step-preview { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }
.step-num { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; color: #fff; }
.step-text { font-size: 15px; color: var(--text); line-height: 1.4; }
.step-water { color: var(--mid-blue); font-weight: 600; }
.step-dur { font-size: 12px; color: var(--subtle); }

/* ═══ Brew Screen ═══ */
.brew-header { display: flex; justify-content: space-between; align-items: center; }
.brew-cancel { background: none; border: none; color: var(--cancel); font-size: 14px; cursor: pointer; }
.brew-name { font-size: 13px; color: var(--subtle); }
.brew-mute { background: none; border: none; font-size: 18px; cursor: pointer; }
.brew-center { text-align: center; margin-top: 20px; }
.brew-total { font-size: 14px; color: var(--subtle); }
.brew-time { font-size: 80px; font-weight: 800; color: var(--deep-blue); line-height: 1; margin: 10px 0; }
.brew-progress { height: 6px; background: var(--border); border-radius: 3px; margin: 10px 0 0; overflow: hidden; }
.brew-progress-fill { height: 100%; border-radius: 3px; transition: width 1s linear; }
.brew-action-pill { display: inline-block; padding: 6px 16px; border-radius: 20px; color: #fff; font-size: 13px; font-weight: 600; margin-top: 12px; }
.brew-instruction { font-size: 26px; color: var(--text); margin: 24px 0 8px; font-weight: 600; line-height: 1.35; }
.brew-water { color: var(--mid-blue); font-size: 18px; font-weight: 700; }
.brew-stepcount { font-size: 13px; color: var(--subtle); margin: 12px 0 0; }

/* ═══ Water Tracker ═══ */
.water-tracker { margin-top: 16px; padding: 12px 16px; background: var(--card); border-radius: 10px; border: 1px solid var(--border); }
.water-tracker-label { font-size: 11px; color: var(--subtle); margin-bottom: 6px; display: flex; justify-content: space-between; }
.water-tracker-bar { height: 10px; background: var(--input-bg); border-radius: 5px; overflow: hidden; position: relative; }
.water-tracker-fill { height: 100%; border-radius: 5px; transition: width 0.5s ease; background: linear-gradient(90deg, var(--deep-blue), var(--mid-blue), var(--light-blue)); }

/* ═══ Bloom Highlight ═══ */
.bloom-active { background: rgba(43,92,122,0.06); border: 1px solid rgba(43,92,122,0.15); border-radius: 16px; padding: 16px; margin: -8px -8px 0; animation: bloom-pulse 2s ease-in-out infinite; }
@keyframes bloom-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(43,92,122,0.1); }
  50% { box-shadow: 0 0 20px 4px rgba(43,92,122,0.15); }
}

/* ═══ Countdown ═══ */
.countdown { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }
.countdown-label { font-size: 18px; color: var(--subtle); margin-bottom: 10px; }
.countdown-num { font-size: 100px; font-weight: 800; color: var(--deep-blue); line-height: 1; }

/* ═══ Brew Done ═══ */
.done-icon { font-size: 48px; }
.done-title { font-size: 22px; color: var(--deep-blue); margin: 10px 0; }
.done-subtitle { color: var(--subtle); font-size: 14px; }

/* ═══ Coming Up ═══ */
.coming-up { margin-top: 30px; border-top: 1px solid var(--border); padding-top: 14px; }
.coming-up-label { font-size: 12px; color: var(--subtle); margin-bottom: 6px; }
.coming-up-step { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.coming-up-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; flex-shrink: 0; }
.coming-up-text { font-size: 14px; color: var(--subtle); }

/* ═══ Scroll to Top ═══ */
.scroll-top { position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px; border-radius: 50%; background: var(--deep-blue); color: #fff; border: none; font-size: 20px; cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; z-index: 50; }

/* ═══ Empty State ═══ */
.empty { text-align: center; padding: 40px; color: var(--subtle); }

/* ═══ Error Banner ═══ */
.error-banner { color: var(--cancel); font-size: 13px; margin: 0 0 10px; padding: 8px 12px; background: #FFF0EF; border-radius: 8px; }

/* ═══ Info Cards ═══ */
.info-grid { padding: 14px 14px 20px; }
.info-grid.wide { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-card { background: var(--card); border-radius: 14px; padding: 18px 16px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 14px; }
.info-card h3 { font-size: 16px; color: var(--deep-blue); margin: 0 0 8px; font-weight: 700; }
.info-card p { font-size: 13px; color: var(--text); line-height: 1.7; margin: 0; }
.info-card a { color: var(--deep-blue); text-decoration: none; font-weight: 600; }
.info-card .brewer-name { font-weight: 700; }
.info-card .brewer-v60 { color: var(--deep-blue); }
.info-card .brewer-chemex { color: var(--orange); }
.info-card .brewer-kalita { color: var(--amber); }
.info-card .brewer-melitta { color: var(--steel); }

.support-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8F5F1 100%);
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--deep-blue);
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.support-link:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}


/* ═══ Grinder Buttons ═══ */
.grinder-btn { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 400; }
.grinder-btn.active { border-color: var(--deep-blue); background: rgba(43,92,122,0.06); color: var(--deep-blue); font-weight: 600; }

/* ═══ Build Form ═══ */
.build-form { background: var(--card); border-radius: 14px; padding: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.build-form h3 { font-size: 15px; color: var(--deep-blue); margin: 0 0 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.form-full { grid-column: 1 / -1; }
.step-item { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; padding: 6px 8px; background: var(--input-bg); border-radius: 6px; font-size: 13px; }
.step-item .remove { margin-left: auto; background: none; border: none; color: var(--cancel); cursor: pointer; font-size: 14px; }
.step-add-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; margin-top: 8px; }
.step-water-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 6px; }

/* ═══ Action Colors ═══ */
.action-bloom { background: var(--amber); color: #fff; }
.action-pour { background: var(--mid-blue); color: #fff; }
.action-stir { background: var(--steel); color: #fff; }
.action-wait { background: var(--subtle); color: #fff; }
.action-drawdown { background: var(--deep-blue); color: #fff; }
