:root {
    --bg: #f4eee8;
    --paper: #fffaf6;
    --paper-2: #f8f0eb;
    --text: #463942;
    --muted: #81747b;
    --line: #dfd1d3;
    --berry: #75445f;
    --berry-2: #f0e1e9;
    --gold: #b99464;
    --gold-2: #f6ead4;
    --red: #b1543f;
    --red-2: #f8e3dc;
    --blue: #638393;
    --blue-2: #dfedf1;
    --brown: #7a4a2e;
    --green: #b6c7be;
    --purple: #8b7b9e;
    --purple-2: #e8e2f2;
    --green-dark: #72957d;
    --green: #b6c7be;
    --green-2: #ccd7d1;
    --wine: #a16578;
    --grey: #918d84;
    --badge-red: #c17665;
    --badge-brown: #956e58;
    --shadow: 0 12px 30px rgba(92, 65, 79, 0.11);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(91, 126, 101, .10), transparent 34rem),
        var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    line-height: 1.55;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.wrap {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
}

.layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.stage {
    flex: 1 1 320px;
    min-width: 0;
}

.hidden {
    display: none !important;
}

header {
    padding: 30px 0 18px;
}

.hero {
    border: 1px solid rgba(53, 107, 82, .16);
    border-radius: 26px;
    padding: 24px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brown);
    font-weight: 700;
    font-size: .88rem;
    letter-spacing: .04em;
}

h1 {
    margin: 6px 0 8px;
    font-size: clamp(1.7rem, 4vw, 2rem);
    line-height: 1.2;
}

h3 {
    margin: 12px 0 6px;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--text);
}

p {
    margin: 6px 0;
    font-size: .88rem;
    line-height: 1.5;
    color: var(--text);
}

.subtitle {
    margin: 0;
    color: var(--muted);
}

.invite-code {
  font-family: monospace;
  font-weight: 700;
  color: var(--berry);
  background: var(--berry-2);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 2px;
}

.hero-help {
    margin-top: 12px;
}

.hero-help summary {
    margin: 0 0 6px;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--berry);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.hero-help summary::-webkit-details-marker {
    display: none;
}

.hero-help summary::before {
    content: '▸ ';
}

.hero-help[open] summary::before {
    content: '▾ ';
}

.hero-help p {
    margin-top: 6px;
}

/* 說明文字裡用來示意實際按鈕/分頁長相的小標籤，純展示用，不能點擊 */
.inline-mock-btn,
.inline-mock-btn-primary,
.inline-mock-tab {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    font-weight: 700;
    cursor: default;
    user-select: none;
    margin: 0 4px;
    /* vertical-align: -3px; */
}

.inline-mock-btn,
.inline-mock-btn-primary {
    border-radius: 8px;
    padding: 2px 7px;
    font-size: .78rem;
}

.inline-mock-btn {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--text);
}

.inline-mock-btn-primary {
    border: 1px solid var(--berry);
    background: var(--berry);
    color: #fff;
}

.inline-mock-tab {
    border: 1px solid var(--berry);
    border-radius: 999px;
    background: var(--berry);
    color: #fff;
    padding: 2px 10px;
    font-size: .78rem;
}

.hide-all {
  display: none;
}

/* Buttons */
.btn {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--text);
    padding: 10px 13px;
    text-decoration: none;
}

.btn:hover {
    border-color: var(--berry);
}

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

.btn-primary {
    border-color: var(--berry);
    background: var(--berry);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(92, 65, 79, .22);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn-primary:hover {
    background: var(--brown);
    border-color: var(--brown);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(92, 65, 79, .28);
}

.btn-favorite.active {
  color: var(--red);
  border-color: rgba(154, 77, 67, 0.35);
  background: var(--red-2);
}

.btn-support {
  margin-top: 8px;
  background: var(--green-2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  border: 0;
  transition: all 0.25s linear;
}

.btn-support:hover {
  background-color: var(--green);
}

.btn-support-has-icon {
  padding: 12px 20px 12px 36px;
}

.btn-support:hover {
  box-shadow: 0 10px 18px var(--shadow);
}

.btn-support-heart {
  width: 16px;
  height: auto;
  margin-left: 6px;
}
.btn-support-coffee {
  width: 40px;
  height: auto;
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%) rotate(-5deg);
  transition: all 0.25s linear;
}
.btn-support:hover .btn-support-coffee {
  transform-origin: bottom center;
  transform: scale(1.1) translateY(-50%) rotate(0deg);
}
.btn-support-brunch {
  width: 48px;
  height: auto;
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%) rotate(-5deg);
  transition: all 0.25s linear;
}
.btn-support:hover .btn-support-brunch {
  transform-origin: bottom center;
  transform: scale(1.1) translateY(-50%) rotate(0deg);
}
.btn-support-taiwanese-fried-chicken {
  width: 48px;
  height: auto;
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%) rotate(-5deg);
  transition: all 0.25s linear;
}
.btn-support:hover .btn-support-taiwanese-fried-chicken {
  transform-origin: bottom center;
  transform: scale(1.2) translateY(-50%) rotate(0deg);
}

.support-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
    visibility 0.28s ease;
}

.support-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.support-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.support-modal-card {
  position: relative;
  width: min(500px, 100%);
  max-height: 90vh;
  padding: 40px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff8f2 0%, #fff3ec 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 24px 60px rgba(88, 64, 82, 0.18);
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition:
    transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 0.28s ease;
}

.support-modal-card::before {
  content: "";
  position: absolute;
  top: -22px;
  left: -22px;
  width: 96px;
  height: 96px;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 220, 166, 0.4),
    transparent 55%
  );
  border-radius: 50%;
}

.support-modal.open .support-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--berry);
  font-size: 1.2rem;
  font-weight: 700;
  transition: all 0.15s ease;
  box-shadow: 0 10px 20px rgba(85, 67, 83, 0.05);
  z-index: 10;
}

.modal-close:hover {
  box-shadow: 0 10px 20px rgba(85, 67, 83, 0.16);
}

.modal-body {
  position: relative;
  z-index: 1;
  /* text-align: center; */
}

.modal-body h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.25rem;
  color: var(--berry);
}

.modal-body h5 {
  margin: 20px 0 0 0;
  font-size: 0.88rem;
  color: var(--berry);
  text-align: center;
}

.modal-body p {
  margin: 8px 0;
}

.support-modal-btns {
  display: flex;
  /* flex-direction: column; */
  flex-wrap: wrap;
  gap: 16px 40px;
  margin-top: 16px;
  align-content: center;
  align-items: center;
  justify-content: center;
}

.invite-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-weight: 700;
  color: var(--text);
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(181, 138, 152, 0.2);
  background: rgba(247, 231, 239, 0.95);
  color: var(--berry);
  text-decoration: none;
  font-weight: 700;
}

.support-link img {
  width: 26px;
  height: 26px;
}

.view-section {
    margin: 12px 0 18px;
    padding: 16px;
    border: 1px solid rgba(53, 107, 82, .16);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 8px 25px rgba(49, 58, 51, .06);
}

.drawer-body .view-section {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.view-section-header {
    margin-bottom: 8px;
}

.view-section-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--berry);
}

.target-panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.target-panel-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.target-panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--berry);
}

.open-database-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.target-panel-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    color: var(--muted);
    font-size: .86rem;
}

.target-panel-meta strong {
    color: var(--text);
}

.target-empty {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .88rem;
}

.target-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.target-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
}

.target-row-main {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.target-row-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}

.target-row .material-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qty-text {
    flex: 0 0 auto;
    white-space: nowrap;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
}

.material-info-inline {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: .82rem;
}

.info-badge {
    position: relative;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--muted);
    font-size: .8rem;
    line-height: 1;
    text-align: center;
    cursor: help;
}

.info-badge:hover,
.info-badge:focus-visible {
    border-color: var(--berry);
    color: var(--berry);
}

.info-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--paper);
    padding: 5px 9px;
    border-radius: 8px;
    font-size: .74rem;
    font-weight: 600;
    white-space: normal;
    width: max-content;
    max-width: min(220px, 60vw);
    text-align: left;
    visibility: hidden;
    opacity: 0;
    transition: opacity .12s ease;
    pointer-events: none;
    z-index: 10;
}

.info-tooltip-multiline {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: min(280px, 70vw);
}

.info-badge:hover .info-tooltip,
.info-badge:focus .info-tooltip {
    visibility: visible;
    opacity: 1;
}

.crafting-qty-hint {
    font-size: .76rem;
    color: var(--muted);
}

.skill-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    padding: 4px 9px;
    font-size: .74rem;
    font-weight: 700;
}

.skill-chip .skill-symbol {
    font-size: .9rem;
}

/* 代辦清單「採集材料」的技能標籤：純文字（不掛技能圖示），同一物品有不只一種
   生活技能都能取得時並排顯示多個。滑鼠移過去／focus 才顯示這一個技能自己的
   取得對象／用途與技巧，跟 .info-badge 共用同一套 .info-tooltip 顯示機制。 */
.skill-label-group {
    flex: 0 0 auto;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-label-chip {
    position: relative;
    flex: 0 0 auto;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    padding: 2px 6px;
    font-size: .7rem;
    font-weight: 700;
    cursor: help;
}

.skill-label-chip:hover,
.skill-label-chip:focus-visible {
    border-color: var(--berry);
    color: var(--berry);
}

.skill-label-chip:hover .info-tooltip,
.skill-label-chip:focus .info-tooltip {
    visibility: visible;
    opacity: 1;
}

.target-row .goal-input {
    flex: 0 0 100px;
    width: 100px;
    padding: 5px 6px;
    text-align: center;
}

.target-remove-btn {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--red);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
}

.target-remove-btn:hover {
    border-color: var(--red);
    background: var(--red-2);
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 12px 0 18px;
    padding: 12px;
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--paper) 93%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 25px rgba(49, 58, 51, .06);
}

.toolbar-top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.toolbar-top .search {
    flex: 1 1 220px;
    width: auto;
}

.toolbar-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.open-todo-btn,
.column-dropdown-toggle,
.filter-toggle-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.filter-toggle-btn.active {
    background: var(--berry-2);
    color: var(--berry);
    border-color: rgba(53, 107, 82, .16);
}

.column-dropdown {
    position: relative;
    flex: 0 0 auto;
}

.column-dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 180px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.column-dropdown.open .column-dropdown-panel {
    display: flex;
}

.column-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: .88rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.column-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--berry);
    cursor: pointer;
}

.filter-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding-top: 2px;
}

.filter-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.filter-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    padding: 6px 11px;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.2;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.filter-chip:hover {
    border-color: var(--berry);
    color: var(--berry);
}

.filter-chip.active {
    background: var(--berry-2);
    color: var(--berry);
    border-color: rgba(53, 107, 82, .16);
}

.location-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* 採集頁籤的地點篩選：讓「狩獵場」「一般野外」框跟「全部地點」按鈕排在同一排，
   靠 display:contents 讓這兩層包裝 div 從盒模型消失，子元素直接變成
   .filter-group-location（flex-wrap）的子項一起換行，不用它單獨往下另起一排。 */
.gathering-location-filter,
.gathering-location-filter .location-groups {
    display: contents;
}

.location-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.location-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.location-group-label {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
}

.location-group-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

/* 外觀借用 .item-category-profession-box 那個「標籤+一排 chip」的框框樣式，
   這裡只加 width:100% 讓這排一定自己獨佔一行，底下 .recipe-mode-panel 才會被推到
   下一行而不是并排在右邊。 */
.recipe-mode-tabs {
    width: 100%;
}

.recipe-mode-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
}

.recipe-mode-panel:empty {
    padding-top: 0;
}

.item-category-subgroup {
    padding-left: 18px;
}

.item-category-subgroup-nested {
    padding-left: 18px;
}

.item-category-profession-box {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 5px 8px;
    background-color: var(--paper-2);
}

.item-category-profession-label {
    margin-left: 2px;
}

.search {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

.search:focus {
    border-color: var(--berry);
    box-shadow: 0 0 0 3px rgba(53, 107, 82, .12);
}

.add-cell {
    width: 100px;
    text-align: center;
}

.add-btn {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--muted);
    padding: 7px 10px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.add-btn:hover {
    border-color: var(--berry);
    color: var(--berry);
}

.add-btn.active {
    background: var(--berry-2);
    color: var(--berry);
    border-color: rgba(53, 107, 82, .2);
}

.badge {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: .76rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.region {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    overflow: hidden;
    box-shadow: 0 5px 18px rgba(49, 58, 51, .04);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th {
    padding: 10px 12px;
    text-align: left;
    color: var(--muted);
    font-size: .78rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
}

td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(217, 211, 197, .78);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: 0;
}

tr.in-target {
    background: color-mix(in srgb, var(--berry-2) 40%, transparent);
}

.skill-name {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-weight: 600;
    color: var(--muted);
    font-size: .82rem;
}

.skill-name .skill-symbol {
    font-size: .95rem;
}

.material-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
}

.location {
    color: #5f625f;
}

.tip {
    color: #5f625f;
}

/* 採集分頁同名材料合併成一列時，技能／等級／採集物／用途與技巧改成每個技能
   各自一行，靠這組 class 讓同一列裡的每一行在跨欄位時維持一致的高度、彼此對齊。 */
.material-stacked {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-stacked-line {
    min-height: 1.4em;
    display: flex;
    align-items: center;
}

.location-type-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    background: var(--paper);
    color: var(--badge-brown);
    border: 1px solid var(--badge-brown);
}

th.location-cell,
td.location-cell {
    max-width: 240px;
}

td.location-cell .location-type-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.goal-input {
    width: 100px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--text);
    padding: 6px 8px;
}

.goal-input:focus {
    border-color: var(--berry);
    outline: none;
}

.note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .78rem;
    max-width: 270px;
}

.empty {
    display: none;
    padding: 28px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

footer {
    color: var(--muted);
    font-size: .78rem;
    padding: 0 0 30px;
    text-align: center;
}

.drawer-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    border: 1px solid rgba(53, 107, 82, .2);
    border-radius: 999px;
    background: var(--berry);
    color: #fff;
    padding: 12px 18px;
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(92, 65, 79, .28);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.drawer-toggle:hover {
    transform: translateY(-2px);
}

.drawer-toggle.open {
    background: var(--paper);
    color: var(--berry);
    border-color: var(--berry);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(70, 57, 66, .28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 45;
}

.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(450px, 100%);
    background: var(--bg);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 30px rgba(92, 65, 79, .18);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.2, .9, .3, 1);
}

.drawer.open {
    transform: translateX(0);
}

.drawer.drawer-wide {
    width: min(760px, 100%);
}

.drawer.sidebar-mode {
    position: sticky;
    top: 12px;
    right: auto;
    flex: 0 0 400px;
    width: 400px;
    height: auto;
    max-height: calc(100vh - 24px);
    transform: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 25px rgba(49, 58, 51, .06);
    background: var(--paper);
    overflow: hidden;
}

.drawer-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--paper-2);
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: var(--berry);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

/* hide element in sidebar mode */
.drawer.sidebar-mode .sidebar-hide {
    display: none;
}

.info-btn {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--berry);
    padding: 6px 12px;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 10px;
}

.info-btn:hover {
    border-color: var(--berry);
    background: var(--berry-2);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(70, 57, 66, .4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    width: min(560px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--berry);
}

.modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--paper-2);
    color: var(--berry);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    font-size: .88rem;
    line-height: 1.6;
    color: var(--text);
}

.modal-body h4 {
    margin: 14px 0 4px;
    color: var(--berry);
    font-size: .92rem;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body p {
    margin: 4px 0;
}

.secondary-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

/* Top-level tab bar (life-skills vs crafting) */
.top-tabs {
    display: flex;
    gap: 8px;
    margin: 18px auto 0;
}

.top-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    padding: 8px 16px;
    font-size: .86rem;
    font-weight: 700;
    cursor: pointer;
}

.top-tab:hover {
    border-color: var(--berry);
    color: var(--text);
}

.top-tab.active {
    background: var(--berry);
    border-color: var(--berry);
    color: #fff;
}

/* Crafting recipe browser */
.crafting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.crafting-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 5px 18px rgba(49, 58, 51, .04);
}

.crafting-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recipe-variant-note {
    font-size: .78rem;
    color: #5f625f;
}

.badge.recipe-processing {
    background: var(--paper);
    color: var(--blue);
    border-color: var(--blue);
}

.badge.recipe-fabrication {
    background: var(--paper);
    color: var(--purple);
    border-color: var(--purple);
}

.crafting-meta {
    color: var(--muted);
    font-size: .8rem;
}

.crafting-ingredients {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crafting-ingredient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: .86rem;
    padding: 6px 8px;
    border-radius: 10px;
    background: var(--paper-2);
}

.crafting-ingredient-row .info-badge {
    margin-left: 6px;
}

.leaf-type-tags {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.leaf-type-tag {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--paper);
    border: 1px solid transparent;
}

.leaf-type-tag.gathering {
    color: var(--green-dark);
    border-color: var(--green-dark);
}

.leaf-type-tag.craft {
    color: var(--blue);
    border-color: var(--blue);
}

.leaf-type-tag.craft-processing {
    color: var(--blue);
    border-color: var(--blue);
}

.leaf-type-tag.craft-fabrication {
    color: var(--purple);
    border-color: var(--purple);
}

.leaf-type-tag.combat {
    color: var(--badge-red);
    border-color: var(--badge-red);
}

.leaf-type-tag.barter {
    color: var(--wine);
    border-color: var(--wine);
}

.leaf-type-tag.purchase {
    color: var(--gold);
    border-color: var(--gold);
}

.leaf-type-tag.decompose {
    color: var(--badge-brown);
    border-color: var(--badge-brown);
}

.leaf-type-tag.pending-recipe {
    background: var(--paper-2);
    color: var(--muted);
    border: 1px dashed var(--line);
}

.leaf-type-tag.other {
    color: var(--grey);
    border-color: var(--grey);
}

.crafting-actions {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: space-around;
    flex-direction: column;
    margin-top: auto;
}

.crafting-actions .action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.crafting-actions label {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: .82rem;
    color: var(--text);
}

.crafting-actions .qty-input {
    box-sizing: border-box;
    height: 38px;
    width: 60px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 8px;
    background: var(--paper);
    color: var(--text);
    font-size: .82rem;
    line-height: 1;
}

.craft-mode-radio {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: 38px;
    gap: 6px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
}

.craft-mode-radio .radio-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .8rem;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.crafting-actions .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.crafting-add-btn {
    box-sizing: border-box;
    width: auto;
    height: 38px;
    flex: 0 0 auto;
}

.craft-mode-radio input[type="radio"] {
    accent-color: var(--berry);
    cursor: pointer;
}

.crafting-result {
    font-size: .82rem;
    color: var(--muted);
    border-top: 1px dashed var(--line);
    padding-top: 8px;
}

.crafting-result strong {
    color: var(--text);
}


/* 代辦清單分區塊：加工品 / 原始材料 / 採集材料 */
.todo-block {
    margin-top: 16px;
}

.todo-block h3 {
    margin: 0 0 8px;
}

.todo-block-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 8px;
}

.todo-block-heading h3 {
    margin: 0;
    flex: 1 1 auto;
}

.btn-sm {
    padding: 5px 10px;
    font-size: .78rem;
}


.craft-item-list,
.raw-material-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.craft-entry-card {
    display: flex;
    flex-direction: column;
}

.craft-breakdown {
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--paper-2);
    font-size: .82rem;
}

.craft-breakdown .crafting-ingredients {
    margin-top: 0;
}

[data-toggle-breakdown].active {
    background: var(--berry-2);
    color: var(--berry);
    border-color: rgba(53, 107, 82, .2);
}

.raw-section-title {
    margin: 10px 0 2px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
}

.raw-section-title:first-child {
    margin-top: 0;
}

.raw-merged-group,
.raw-isolated-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    margin-bottom: 8px;
}

.raw-merged-sources {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.raw-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.raw-group-header h4 {
    margin: 0;
    font-size: .92rem;
    color: var(--text);
}

.raw-group-header .info-badge {
    margin-left: 6px;
    font-weight: 400;
}

.raw-group-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.move-arrow {
    display: inline-block;
    font-size: 1.35em;
    line-height: 1;
    vertical-align: middle;
    transform: translateY(-2px);
}

.questboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.questboard-row .target-row-main {
    flex-wrap: wrap;
}

.questboard-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    accent-color: var(--berry);
    cursor: pointer;
}

.questboard-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.questboard-add-btn {
    margin-left: auto;
}

.questboard-times-input {
    flex: 0 0 52px;
    width: 52px;
    padding: 5px 4px;
    text-align: center;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 12px);
    z-index: 100;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--berry);
    color: var(--paper);
    font-size: .86rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 760px) {
    .wrap {
        width: min(100% - 18px, 1180px);
    }

    header {
        padding-top: 14px;
    }

    .hero {
        padding: 18px;
        border-radius: 20px;
    }

    .toolbar {
        position: static;
    }

    .toolbar-top .search {
        flex-basis: 100%;
    }

    .toolbar-actions-row {
        width: 100%;
        padding-bottom: 2px;
    }
    
    .toolbar-top .search,
    .toolbar-actions-row .btn {
        font-size: .8rem;
    }

    .toolbar-actions-row .btn,
    .toolbar-actions-row .column-dropdown {
        flex-shrink: 0;
    }

    /* iOS Safari 會自動放大畫面聚焦到 font-size 小於 16px 的輸入框，
       這裡把所有數字/文字輸入框在手機寬度下強制拉到 16px 避免這個行為。
       部分輸入框（例如 .crafting-actions .qty-input）本來就用 class 選擇器設定更小的
       字級，特異度比單純的 input[type] 高，所以這裡照原本的選擇器路徑覆寫，靠寫在
       後面的規則贏過前面。 */
    input[type="number"],
    input[type="search"],
    input[type="text"],
    .crafting-actions .qty-input[type="number"] {
        font-size: 16px;
    }

    .column-dropdown-panel {
        right: auto;
        left: 0;
    }

    .filter-groups {
        grid-template-columns: 1fr;
    }

    .drawer {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: min(85vh, 640px);
        border-left: 0;
        border-top: 1px solid var(--line);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .drawer.open {
        transform: translateY(0);
    }

    .drawer.sidebar-mode {
        position: static;
        flex-basis: 100%;
        width: 100%;
        max-height: none;
        order: -1;
    }

    .drawer-toggle {
        right: 12px;
        bottom: 12px;
        padding: 10px 14px;
        font-size: .8rem;
    }

    /* 手機螢幕放不下側邊欄模式的兩欄版面，不提供這個切換選項，一律用浮動面板。 */
    .drawer-pin {
        display: none;
    }

    /* 分頁按鈕吸頂，往下捲動時仍然看得到、點得到。 */
    .top-tabs {
        position: sticky;
        top: 0;
        z-index: 30;
        margin-top: 0;
        /* background: rgba(255, 255, 255 , .6); */
        margin: 0;
        padding: 10px;
        width: 100%;
        justify-content: center;
        gap: 6px;
    }

    .top-tab {
        font-size: .8rem;
        padding: 6px 10px;
    }
}