/* ==========================================================================
   DIAL MARK - coffee journal
   Mobile-first, single-thumb, light theme. No external libraries.
   Palette: warm off-white, white cards, charcoal ink, sage, burnt orange.
   ========================================================================== */

:root {
  --bg: #faf7f1;
  --bg-soft: #f1ece2;
  --card: #ffffff;
  --ink: #2c2a26;
  --ink-soft: #6f6a61;
  --ink-faint: #a29c91;
  --line: #e9e2d6;
  --sage: #8fa383;
  --sage-deep: #68795c;
  --sage-tint: #edf1e7;
  --orange: #c56a3c;
  --orange-deep: #a3502a;
  --orange-tint: #f9ece3;
  --star: #c56a3c;
  --danger: #c0503a;
  --danger-tint: #f9e9e4;
  --shadow-sm: 0 1px 2px rgba(44, 42, 38, 0.05), 0 4px 12px rgba(44, 42, 38, 0.05);
  --shadow-md: 0 2px 4px rgba(44, 42, 38, 0.06), 0 12px 28px rgba(44, 42, 38, 0.1);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
}

input,
textarea {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

svg {
  display: block;
  flex: none;
}

.btn svg,
.picker-btn svg,
.chev svg,
.adv-toggle svg,
.sheet-row .check svg {
  width: 18px;
  height: 18px;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

#screen::-webkit-scrollbar {
  display: none;
}

/* ============================ tab bar =================================== */

#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-faint);
  transition: color 0.18s ease, transform 0.18s ease;
}

.tab-btn svg {
  width: 24px;
  height: 24px;
}

.tab-btn span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.tab-btn:active {
  transform: scale(0.92);
}

.tab-btn.active {
  color: var(--orange);
}

/* ============================ typography ================================ */

.wordmark {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.wordmark em {
  font-style: normal;
  color: var(--orange);
}

.kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.screen-head h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 22px 0 10px;
}

/* ============================ buttons =================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 0 rgba(44, 42, 38, 0.12), 0 10px 22px rgba(197, 106, 60, 0.28);
}

.btn-primary:active {
  background: var(--orange-deep);
}

.btn-sage {
  background: var(--sage);
  color: #fff;
  box-shadow: 0 2px 0 rgba(44, 42, 38, 0.1), 0 10px 22px rgba(104, 121, 92, 0.24);
}

.btn-sage:active {
  background: var(--sage-deep);
}

.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-ghost:active {
  background: var(--bg-soft);
}

.btn-danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.btn-soft {
  background: var(--sage-tint);
  color: var(--sage-deep);
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 11px;
}

.btn-lg {
  min-height: 58px;
  font-size: 17px;
  border-radius: 18px;
}

.btn-block {
  width: 100%;
}

.btn .check-ic {
  display: none;
}

.btn.saved {
  background: var(--sage) !important;
  color: #fff;
  box-shadow: none;
  animation: btnSaved 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn.saved .check-ic {
  display: inline;
}

@keyframes btnSaved {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ============================ cards & rows ============================== */

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.row:last-child {
  border-bottom: none;
}

.row:active {
  background: var(--bg-soft);
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-title.serif {
  font-family: var(--serif);
  font-weight: 700;
}

.row-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-end {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.chev {
  color: var(--ink-faint);
  flex: none;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-soft);
  flex: none;
}

.thumb.bean {
  border-radius: 50%;
}

.thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  background: var(--sage-tint);
}

.rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--orange-deep);
  background: var(--orange-tint);
  border-radius: 9px;
  padding: 2px 8px;
}

.rating-chip .star {
  color: var(--star);
  font-size: 11px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.date-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.4px;
}

/* ============================ home / brew =============================== */

.home-hero {
  padding: 6px 0 2px;
}

.log-brew-btn {
  width: 100%;
  min-height: 64px;
  border-radius: 20px;
  font-size: 17px;
  background: var(--orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 3px 0 rgba(44, 42, 38, 0.14), 0 16px 30px rgba(197, 106, 60, 0.3);
  animation: fadeUp 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.log-brew-btn:active {
  transform: scale(0.98);
  background: var(--orange-deep);
}

.log-brew-btn svg {
  width: 22px;
  height: 22px;
}

.home-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  margin-bottom: 2px;
}

.home-sub .section-label {
  margin: 0;
}

.home-count {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 600;
}

.brew-row .row-sub b {
  color: var(--ink);
  font-weight: 700;
}

.brew-row .grind-line {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ============================ bean grid ================================= */

.bean-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.bean-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.bean-card:active {
  transform: scale(0.97);
}

.bean-photo-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--sage-tint);
}

.bean-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bean-photo-wrap .photo-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
  opacity: 0.55;
}

.bean-photo-wrap .photo-ph svg {
  width: 40px;
  height: 40px;
}

.bean-rating {
  position: absolute;
  top: 8px;
  right: 8px;
}

.bean-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.bean-info .row-title {
  font-family: var(--serif);
  font-size: 15px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

.bean-info .row-sub {
  font-size: 12px;
}

/* search + filters */

.search-wrap {
  position: relative;
  margin-bottom: 10px;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 0 16px 0 42px;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(143, 163, 131, 0.18);
}

.search-input::placeholder {
  color: var(--ink-faint);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  margin-bottom: 4px;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.18s ease;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip:active {
  transform: scale(0.94);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.toolbar .btn {
  min-height: 40px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 12px;
}

/* ============================ bean detail =============================== */

.hero {
  position: relative;
  margin: calc(-14px - env(safe-area-inset-top)) -18px 0;
  height: min(52vh, 430px);
  background: var(--sage-tint);
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: heroIn 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes heroIn {
  from { transform: scale(1.08); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}

.hero .hero-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
  opacity: 0.5;
}

.hero .hero-ph svg {
  width: 90px;
  height: 90px;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(44, 42, 38, 0.28) 0%, rgba(44, 42, 38, 0) 34%, rgba(44, 42, 38, 0.55) 100%);
  pointer-events: none;
}

.back-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  z-index: 3;
  transition: transform 0.12s ease;
}

.back-btn:active {
  transform: scale(0.9);
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.hero-title {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 2px 14px rgba(44, 42, 38, 0.45);
}

.hero-title h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.4px;
}

.hero-title .hero-roaster {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 3px;
}

.big-rating {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-family: var(--serif);
}

.big-rating .num {
  font-size: 34px;
  font-weight: 700;
  color: var(--orange-deep);
}

.big-rating .max {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-faint);
}

.big-rating .st {
  font-size: 20px;
  color: var(--star);
  margin-right: 4px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 16px;
}

.meta-cell {
  background: var(--card);
  padding: 10px 12px;
}

.meta-cell .k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.meta-cell .v {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.note-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* best shot */

.best-shot {
  position: relative;
  border: 1.5px solid rgba(197, 106, 60, 0.35);
  background: linear-gradient(180deg, #fffdf9, #fdf6ef);
  overflow: hidden;
}

.best-shot::before {
  content: "";
  position: absolute;
  top: -46px;
  right: -46px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(197, 106, 60, 0.08);
}

.best-shot-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.best-shot-head .star-big {
  font-size: 22px;
  color: var(--star);
  animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.best-shot-head .ttl {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.grinder-chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.grinder-chip {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all 0.18s ease;
}

.grinder-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 6px 16px rgba(197, 106, 60, 0.28);
}

.recipe-line {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
  letter-spacing: -0.2px;
}

.recipe-sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

.best-note {
  font-size: 13.5px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.best-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.best-actions .btn {
  flex: 1;
}

/* ============================ forms ===================================== */

.form-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
}

.field-label .opt {
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.text-input,
.textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 0 14px;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  font-size: 16px;
}

.textarea {
  min-height: 88px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.5;
}

.text-input:focus,
.textarea:focus {
  border-color: var(--sage);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(143, 163, 131, 0.18);
}

.text-input::placeholder,
.textarea::placeholder {
  color: var(--ink-faint);
}

.num-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

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

.num-field {
  position: relative;
}

.num-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 0 34px 0 14px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.num-field input::-webkit-outer-spin-button,
.num-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.num-field input:focus {
  border-color: var(--sage);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(143, 163, 131, 0.18);
}

.num-field .unit {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
  pointer-events: none;
}

.picker-btn {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 0 14px;
  text-align: left;
  transition: border 0.2s ease;
}

.picker-btn:active {
  background: var(--bg-soft);
}

.picker-btn .pk-ph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--sage-tint);
  flex: none;
}

.picker-btn .pk-ph-ph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sage-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
  flex: none;
  font-size: 13px;
}

.picker-btn .pk-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-btn .pk-name.ph {
  color: var(--ink-faint);
  font-weight: 500;
}

.picker-btn svg {
  color: var(--ink-faint);
  flex: none;
}

/* photo picker */

.photo-pick {
  display: flex;
  align-items: center;
  gap: 14px;
}

.photo-preview {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--bg-soft);
  flex: none;
}

.photo-preview-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  background: var(--sage-tint);
  color: var(--sage-deep);
}

.photo-preview-ph svg {
  width: 24px;
  height: 24px;
}

.photo-pick .btn {
  flex: 1;
}

/* advanced details */

.adv-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.4px;
}

.adv-toggle svg {
  transition: transform 0.25s ease;
  color: var(--ink-faint);
}

.adv-toggle.open svg {
  transform: rotate(180deg);
}

.adv-body {
  display: none;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.adv-body.open {
  display: block;
  animation: fadeDown 0.3s ease both;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* taste tags */

.tag-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tag-group .tg-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.tag:active {
  transform: scale(0.92);
}

.tag.selected {
  background: var(--sage-tint);
  border-color: var(--sage);
  color: var(--sage-deep);
  animation: tagPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tagPop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* rating slider */

.rating-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rating-num {
  flex: none;
  width: 74px;
  text-align: center;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--orange-deep);
  background: var(--orange-tint);
  border-radius: var(--r-md);
  padding: 6px 0;
}

.rating-num.none {
  color: var(--ink-faint);
  background: var(--bg-soft);
  font-size: 22px;
}

.rating-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 44px;
  background: transparent;
  cursor: pointer;
}

.rating-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orange) 0%, var(--orange) var(--fill, 50%), var(--line) var(--fill, 50%));
}

.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--orange);
  box-shadow: 0 2px 8px rgba(44, 42, 38, 0.25);
  margin-top: -10px;
  transition: transform 0.12s ease;
}

.rating-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

.rating-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}

.rating-slider::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--orange);
}

.rating-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--orange);
  box-shadow: 0 2px 8px rgba(44, 42, 38, 0.25);
}

/* ============================ sheets ==================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(44, 42, 38, 0.4);
  opacity: 0;
  animation: backdropIn 0.25s ease forwards;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  animation: sheetIn 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  box-shadow: 0 -12px 40px rgba(44, 42, 38, 0.18);
}

@keyframes sheetIn {
  from { transform: translateY(60px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 2px auto 10px;
  flex: none;
}

.sheet-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  flex: none;
}

.sheet-search {
  margin-bottom: 10px;
  flex: none;
}

.sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.sheet-row:active {
  background: var(--bg-soft);
}

.sheet-row .row-title {
  font-size: 15px;
}

.sheet-row .check {
  margin-left: auto;
  color: var(--sage-deep);
  flex: none;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex: none;
}

.sheet-actions .btn {
  flex: 1;
}

.sheet-cancel {
  min-height: 48px;
  margin-top: 10px;
  flex: none;
  font-weight: 600;
  color: var(--ink-soft);
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
}

/* confirm dialog */

.confirm-box {
  padding: 8px 0 0;
}

.confirm-box p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

/* ============================ toast ===================================== */

#toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  max-width: 86vw;
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.out {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ============================ brew detail =============================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 16px;
}

.stat-cell {
  background: var(--card);
  padding: 12px 8px;
  text-align: center;
}

.stat-cell .k {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stat-cell .v {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  color: var(--ink);
}

.stat-cell .v.sage {
  color: var(--sage-deep);
}

.stat-cell .v.orange {
  color: var(--orange-deep);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-cloud .pill {
  background: var(--sage-tint);
  color: var(--sage-deep);
  font-weight: 600;
  font-size: 12.5px;
  padding: 4px 12px;
}

.brew-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-box {
  background: var(--sage-tint);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-top: 14px;
  border: 1px solid rgba(143, 163, 131, 0.35);
  animation: fadeUp 0.4s ease both;
}

.ai-box .ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--sage-deep);
  margin-bottom: 10px;
}

.ai-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-text b {
  font-weight: 800;
}

.ai-text .ai-section {
  font-weight: 800;
  display: block;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--sage-deep);
}

.ai-text .ai-section:first-child {
  margin-top: 0;
}

.ai-recipe {
  margin-top: 14px;
  background: var(--card);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.ai-recipe .recipe-line {
  font-size: 17px;
  margin-top: 0;
}

.ai-recipe .recipe-sub {
  font-size: 13px;
}

/* ============================ empty states ============================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 24px;
  gap: 6px;
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px dashed var(--line);
  animation: fadeUp 0.4s ease both;
}

.empty .empty-ic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty .empty-ic svg {
  width: 26px;
  height: 26px;
}

.empty h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
}

.empty p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 260px;
}

.empty .empty-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin-top: 12px;
}

/* ============================ settings ================================== */

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.set-row:last-child {
  border-bottom: none;
}

.set-row .set-label {
  font-size: 15px;
  font-weight: 700;
}

.set-row .set-sub {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 1px;
  font-weight: 500;
}

.switch {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--line);
  flex: none;
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(44, 42, 38, 0.25);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.switch.on {
  background: var(--sage);
}

.switch.on::after {
  transform: translateX(20px);
}

.status-line {
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  line-height: 1.4;
}

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

.status-line.err {
  color: var(--danger);
}

.select-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 0 12px;
  outline: none;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a29c91' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.select-input:focus {
  border-color: var(--sage);
}

/* ============================ animations ================================ */

.screen {
  animation: screenIn 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes starPop {
  0% { transform: scale(0.4) rotate(-20deg); }
  60% { transform: scale(1.25) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}

.star-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

.star-btn .star-glyph {
  font-size: 19px;
  color: var(--ink-faint);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-btn.on {
  color: var(--orange-deep);
}

.star-btn.on .star-glyph {
  color: var(--star);
  animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-ghost.on {
  color: var(--orange-deep);
  border-color: rgba(197, 106, 60, 0.45);
  background: var(--orange-tint);
}

.btn-ghost.on .star-glyph {
  color: var(--star);
  animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-glyph {
  font-size: 17px;
  line-height: 1;
}

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

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spinner 0.7s linear infinite;
  flex: none;
}

.spinner.dark {
  border-color: rgba(143, 163, 131, 0.3);
  border-top-color: var(--sage-deep);
}

.divider-note {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin: 18px 0 12px;
}

.divider-note::before,
.divider-note::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.link-btn {
  color: var(--sage-deep);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.link-btn:active {
  opacity: 0.7;
}

.link-btn svg {
  width: 15px;
  height: 15px;
}

.about-line {
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.6;
  text-align: center;
  margin-top: 18px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
