:root {
  --ink: #17251c;
  --muted: #667269;
  --deep: #173c2d;
  --green: #2f7450;
  --moss: #8baa63;
  --water: #72a99a;
  --paper: #fff4cf;
  --paper-dark: #e8d297;
  --wood: #70492d;
  --wood-dark: #432a1a;
  --gold: #e5c45c;
  --coral: #d96e59;
  --blue: #4f7ba8;
  --surface: #ffffff;
  --line: #d7dfd4;
  --shadow: 0 10px 28px rgba(23, 48, 34, 0.14);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: #dce8d8;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }

body {
  display: flex;
  justify-content: center;
  background-image: url("../Textures/green.jpg");
  background-size: 560px auto;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100dvh;
  background: #f4f2e7;
  box-shadow: 0 0 46px rgba(20, 42, 29, 0.24);
  overflow: hidden;
}

.app-header {
  position: fixed;
  z-index: 40;
  top: 0;
  width: min(100%, 460px);
  height: calc(70px + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 14px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

html.telegram-fullscreen .app-header { justify-content: center; }
html.telegram-fullscreen .header-title,
html.telegram-fullscreen .fullscreen-button { display: none; }
html.telegram-fullscreen .header-actions { flex: 0 0 auto; }

.header-back,
.header-action,
.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd6c8;
  border-radius: 6px;
  background: #f8faf7;
  color: var(--deep);
  font-size: 20px;
}

.icon-button.active { border-color: var(--green); background: #dcebd5; }

.header-action { font-size: 17px; }
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.fullscreen-button,
.theme-toggle-button { width: 34px; height: 34px; flex-basis: 34px; font-size: 18px; }
.theme-toggle-button { font-size: 17px; }
.header-title { min-width: 0; flex: 1; }
.header-title h1 { margin: 0; font: 800 20px/1.05 Georgia, serif; }
.header-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.balance-pill {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 2px;
  border: 0;
  border-radius: 8px;
  padding: 6px 9px;
  background: #dcebd5;
  color: #254d35;
  font-size: 10px;
  line-height: 1.05;
  font-weight: 900;
}

.app-view {
  height: 100dvh;
  min-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(70px + env(safe-area-inset-top)) 0 calc(72px + env(safe-area-inset-bottom));
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  bottom: 0;
  width: min(100%, 460px);
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.nav-button {
  border: 0;
  background: transparent;
  color: #536259;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
}

.nav-button span { display: block; margin-top: 4px; font-size: 9px; font-weight: 800; }
.nav-button.active { background: #e3eedf; color: var(--deep); }

.section { padding: 14px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.section-title h2 { margin: 0; font: 800 18px/1.1 Georgia, serif; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.section-link { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 900; }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
  padding: 5px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.segment {
  min-height: 36px;
  border: 1px solid #ccd6ca;
  border-radius: 5px;
  background: #fff;
  color: #506158;
  font-size: 10px;
  font-weight: 900;
}

.segment.active { background: var(--deep); border-color: var(--deep); color: #fff; }

.toolbar {
  display: flex;
  gap: 7px;
  padding: 8px 12px;
  background: #e8eee2;
  border-bottom: 1px solid #d0dacd;
}

.search-field {
  min-width: 0;
  height: 38px;
  flex: 1;
  border: 1px solid #c7d2c4;
  border-radius: 5px;
  background: #fff;
  padding: 0 11px;
  color: var(--ink);
  font-size: 12px;
}

.search-field::placeholder { color: #88938a; }

.primary-button,
.secondary-button,
.danger-button,
.gold-button {
  min-height: 42px;
  border: 0;
  border-radius: 5px;
  padding: 10px 13px;
  font-size: 11px;
  font-weight: 900;
}

.primary-button { background: var(--green); color: #fff; }
.secondary-button { background: #e6ebe3; color: #314237; }
.danger-button { background: #f2d9d3; color: #8e362b; }
.gold-button { background: var(--gold); color: #352d18; }
.wide-button { width: 100%; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.photo-composer textarea { font: inherit; }
.photo-generation-controls { padding: 12px 16px; }
.photo-generation-controls p { margin: 0 0 10px; font-size: 12px; line-height: 1.6; }
.photo-generation-controls .secondary-button { margin-top: 8px; }
.photo-composer textarea { resize: vertical; min-height: 110px; max-height: 28dvh; }
.photo-composer #photo-count { text-align: right; font-variant-numeric: tabular-nums; }
.photo-composer [aria-invalid="true"] { border-color: #a53434; }
.social-view { padding: 14px; }
.social-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; background: #e1e6dd; border-radius: 6px; padding: 3px; gap: 3px; }
.social-tabs button { min-width: 0; min-height: 48px; padding: 6px; border: 0; border-radius: 4px; background: transparent; color: #354438; font-size: 12px; line-height: 1.3; }
.social-tabs button[aria-selected="true"] { background: #fff; color: #173a28; box-shadow: 0 1px 3px #0002; font-weight: 700; }
.social-view .search-field { width: 100%; min-width: 0; margin-bottom: 14px; }
.social-card { overflow: hidden; border: 1px solid #c8d0c5; border-radius: 8px; margin: 0 0 16px; background: #fff; }
.social-photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #d7e2d1; }
.social-photo.image-placeholder { display: grid; place-items: center; font-size: 64px; }
.social-photo[hidden] { display: none; }
@media (min-width: 960px) {
  .social-view--parade { width: min(100%, 568px); margin-inline: auto; }
  .social-view--parade .social-card { margin-bottom: 24px; }
  .social-view--parade .social-photo { aspect-ratio: 4 / 3; object-fit: contain; }
}
.social-card-details { padding: 12px; overflow-wrap: anywhere; }
.social-card h2 { font-size: 18px; margin: 0 0 6px; }
.social-card p { margin: 8px 0; line-height: 1.5; font-size: 13px; }
.social-card button { margin: 8px 6px 0 0; min-height: 44px; }
.social-card small { display: block; margin-top: 8px; }
.social-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.social-date { color: #5d685e; }
.social-list-state { padding: 20px 0; text-align: center; }
.social-error { color: #a53434; overflow-wrap: anywhere; }
.social-sheet { overflow-y: auto; max-height: 90dvh; }
.social-sheet .social-photo { width: min(100%, 45dvh); height: auto; aspect-ratio: 1; margin: 12px auto; }
.social-sheet p { line-height: 1.5; overflow-wrap: anywhere; }
.social-sheet .wide-button + .wide-button { margin-top: 10px; }
.social-result, .kiss-reward { padding: 10px 0; border-top: 1px solid #c8d0c5; }
html[data-theme="dark"] .social-card { background: #1e2b23; border-color: #46584b; }
html[data-theme="dark"] .social-photo { background: #344b3b; }
html[data-theme="dark"] .social-tabs { background: #293c30; }
html[data-theme="dark"] .social-tabs button { color: #c3d1c6; }
html[data-theme="dark"] .social-tabs button[aria-selected="true"] { background: #54705b; color: #fff; }
html[data-theme="dark"] .social-date { color: #b5c4b9; }
html[data-theme="dark"] .social-error { color: #ffb5aa; }
html[data-theme="dark"] .social-result, html[data-theme="dark"] .kiss-reward { border-color: #46584b; }

/* Private games */
.private-game { padding: 12px; }
.game-picture { width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 5px; background: #cbd8c2; box-shadow: var(--shadow); }
.game-picture img, .game-picture video, .game-picture .image-placeholder { width: 100%; height: 100%; object-fit: cover; }
.game-copy { margin: 10px 0; padding: 13px; border: 1px solid #ccd6ca; border-radius: 5px; background: #fff; }
.game-category { margin: 0 0 9px; color: #496454; font-size: 10px; font-weight: 900; line-height: 1.55; white-space: pre-line; }
.game-answer-format { margin: 0 0 10px; border-left: 3px solid #d2a43d; padding: 7px 9px; background: #fff4cf; color: #51462f; font-size: 9px; }
.game-mask { overflow-wrap: anywhere; font: 800 17px/1.5 Georgia, serif; }
.game-progress { margin: 9px 0 0; color: var(--muted); font-size: 8px; }
.game-letter-state { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 9px; font-size: 9px; }
.game-letter-state p { margin: 0; }.game-letter-state .absent { color: #9b4b42; }
.guess-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.guess-form .text-input { min-width: 0; }
.game-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 8px 0; }
.game-tools button { min-width: 0; padding-inline: 5px; font-size: 9px; }
.game-transfer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 8px 0; border: 1px solid #b9c9b7; border-radius: 5px; padding: 9px 10px; background: #e9f2e4; }
.game-transfer > span { min-width: 0; display: grid; gap: 4px; }.game-transfer b { font-size: 9px; }.game-transfer code { overflow-wrap: anywhere; color: #335340; font-size: 8px; user-select: text; }
.game-activity { margin: 9px 0; overflow: hidden; border: 1px solid #cbd6c8; border-radius: 5px; background: #eef3eb; }
.game-activity-title { min-height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-bottom: 1px solid #d4ddd1; font-size: 10px; }
.game-activity-title span { min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #d7e7d1; color: var(--deep); font-size: 8px; font-weight: 900; }
.game-activity-list { max-height: 250px; overflow-y: auto; display: grid; gap: 1px; overscroll-behavior: contain; }
.game-activity-entry { min-height: 48px; display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; gap: 7px; align-items: start; padding: 8px 9px; background: #fff; }
.game-activity-entry.near { background: #fff8d9; }.game-activity-entry.success { background: #e5f2df; }.game-activity-entry.hint, .game-activity-entry.letters { background: #fff4cf; }
.game-activity-icon { padding-top: 1px; font-size: 17px; }.game-activity-entry > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }.game-activity-entry b { font-size: 9px; }.game-activity-entry small { overflow-wrap: anywhere; white-space: pre-line; color: #3f5046; font-size: 9px; line-height: 1.4; }.game-activity-entry time { color: var(--muted); font-size: 7px; }
.game-activity-empty { margin: 0; padding: 14px 10px; color: var(--muted); font-size: 9px; text-align: center; }
.hint-target-list { max-height: 62dvh; overflow-y: auto; display: grid; gap: 7px; }
.hint-target { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid #c6d2c3; border-radius: 5px; padding: 8px 10px; background: #fff; color: var(--ink); text-align: left; }
.hint-target.primary-target { border-color: #7fa688; background: #e4efdf; }.hint-target > span:first-child { min-width: 0; display: grid; gap: 4px; }.hint-target b { font-size: 10px; }.hint-target small { overflow-wrap: anywhere; color: var(--muted); font: 700 10px Georgia, serif; }.hint-target > span:last-child { color: var(--green); font-size: 9px; font-weight: 900; }
.movie-link { display: block; margin: 8px 0; color: var(--green); font-size: 10px; font-weight: 900; text-align: center; }
.game-preparing { min-height: calc(100dvh - 134px); display: grid; place-content: center; padding: 30px; text-align: center; }
.game-preparing h2 { margin: 12px 0 5px; font: 800 20px Georgia, serif; }.game-preparing p { color: var(--muted); font-size: 10px; }.game-spinner { font-size: 56px; animation: game-bob .9s ease-in-out infinite alternate; }
@keyframes game-bob { to { transform: translateY(-10px); } }
.letter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.letter-grid button { aspect-ratio: 1; border: 1px solid #aebdad; border-radius: 4px; background: #eef3eb; color: var(--deep); font-weight: 900; }
.insect-payment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.alchemy-select-grid { max-height: 48dvh; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 10px 0; }
.alchemy-select-grid label input { position: absolute; opacity: 0; pointer-events: none; }
.alchemy-select-grid label > span { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); column-gap: 7px; align-items: center; block-size: 60px; border: 2px solid #d2d9cf; border-radius: 5px; padding: 4px; background: #fff; }
.alchemy-select-grid label input:checked + span { border-color: var(--green); background: #e4efdf; }
.alchemy-select-grid img, .alchemy-select-grid .image-placeholder { grid-row: 1 / 3; width: 48px; height: 48px; object-fit: cover; border-radius: 3px; font-size: 22px; }
.alchemy-select-grid b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }.alchemy-select-grid small { color: var(--muted); font-size: 8px; }
.game-cooldown-status { margin: 10px 0; color: var(--green); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.warning.alchemy-confirm-warning { font-size: 12px; }
.alchemy-confirm-items { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); align-items: center; gap: 8px; margin: 16px 0; }
.alchemy-confirm-items div { min-width: 0; }
.alchemy-confirm-items b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.alchemy-confirm-items small { display: block; color: var(--muted); margin-top: 4px; }
.alchemy-plus { text-align: center; font-size: 18px; }
.alchemy-price { margin: 14px 0; font-size: 13px; }
.alchemy-price div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; }
.alchemy-price dd { margin: 0; font-weight: 700; }
.alchemy-price-total { border-top: 1px solid var(--line); font-weight: 700; }
.selection-loading { padding: 30px 12px; color: var(--muted); text-align: center; }
.jabyakovka-options { max-height: 68dvh; display: grid; gap: 8px; overflow-y: auto; padding: 2px; }
.jabyakovka-option { min-height: 78px; display: grid; grid-template-columns: 66px minmax(0, 1fr) 14px; gap: 9px; align-items: center; border: 1px solid #ccd6ca; border-radius: 5px; padding: 5px; background: #fff; color: var(--ink); text-align: left; }
.jabyakovka-option-image { width: 66px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 3px; background: #dce8d8; font-size: 28px; }
.jabyakovka-option-image img { width: 100%; height: 100%; object-fit: cover; }
.jabyakovka-option-copy { min-width: 0; display: grid; gap: 4px; }.jabyakovka-option-copy b { font-size: 10px; }.jabyakovka-option-copy small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.game-history { display: grid; gap: 8px; padding: 12px; }
.game-history-row { min-height: 72px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 24px; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 5px; padding: 9px; background: #fff; color: var(--ink); text-align: left; box-shadow: 0 4px 12px rgba(23, 48, 34, .08); }
.game-history-icon { font-size: 27px; }.game-history-row > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }.game-history-row b { font-size: 10px; }.game-history-row small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }.game-history-status { font-style: normal; }
.game-result { display: grid; gap: 9px; padding: 12px; }
.game-result-paper { border: 1px solid #d7c58f; border-radius: 5px; padding: 14px; background: var(--paper); box-shadow: var(--shadow); }
.game-result-text { overflow-wrap: anywhere; white-space: pre-line; font: 700 13px/1.55 Georgia, serif; }
.game-result-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; margin-top: 12px; padding-top: 9px; border-top: 1px solid #dccb9d; color: var(--muted); font-size: 8px; }
.game-result-letters { margin: 9px 0 0; color: var(--muted); font-size: 9px; }.result-movie-link { margin: 0; border: 1px solid #a9c4ad; border-radius: 5px; padding: 11px; background: #fff; }

/* Cabinet */
.cabinet-summary { display: flex; gap: 9px; align-items: center; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.cabinet-guild-link { width: calc(100% - 24px); min-height: 54px; display: grid; grid-template-columns: 34px minmax(0, 1fr) 14px; gap: 8px; align-items: center; margin: 9px 12px 0; padding: 7px 10px; border: 1px solid #c7d4c3; border-radius: 5px; background: #e8f0e4; color: var(--ink); text-align: left; }
.cabinet-guild-link > span:first-child { font-size: 24px; text-align: center; }
.cabinet-guild-link > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.cabinet-guild-link b { font-size: 10px; }
.cabinet-guild-link small { color: var(--muted); font-size: 8px; }
.cabinet-guild-link > span:last-child { color: var(--green); font-size: 20px; font-weight: 900; }
.capacity-meter { flex: 1; }
.capacity-line { display: flex; justify-content: space-between; font-size: 10px; font-weight: 900; }
.meter { height: 6px; margin-top: 6px; background: #dde4da; border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--green); }
.cabinet-shell { margin: 8px 6px 14px; height: calc(100dvh - 285px); min-height: 420px; padding: 1px; background: var(--wood) url("../Textures/derevo.jpg") center/cover; border: 4px solid var(--wood-dark); border-radius: 6px; box-shadow: inset 0 0 0 1px #9c7043, var(--shadow); }
.cabinet-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #ddc37e #5a3a25; scrollbar-width: thin; }
.cabinet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0; }
.cabinet-cell.item-cell { cursor: pointer; }
.cabinet-toolbar { flex-wrap: wrap; }
.cabinet-toolbar .season-filter { flex: 0 0 100%; min-height: 38px; color: var(--ink); }
.item-lock-badge { position: absolute; left: 4px; top: 4px; padding: 3px; border-radius: 50%; background: #fff; font-size: 11px; }
.item-lock-button { margin-top: 8px; }
.discovery-list { display: grid; gap: 8px; padding: 12px; }
.discovery-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 14px; gap: 10px; align-items: center; min-height: 70px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); text-align: left; }
.discovery-thumb, .discovery-thumb > img, .discovery-thumb > .image-placeholder { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; }
.discovery-row b { display: block; font-size: 12px; overflow-wrap: anywhere; }
.discovery-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.discovery-arrow { color: var(--green); font-size: 20px; text-align: center; }
.discovery-sheet .sheet-head h2, .discovery-sheet .detail-text { overflow-wrap: anywhere; }
.discovery-sheet .sheet-close { flex-shrink: 0; }
.image-placeholder { display: grid; place-items: center; background: #cbd8c2; color: #173c2d; font-size: 34px; }
.cabinet-cell > .image-placeholder,
.recipe-tile > .image-placeholder { width: 100%; aspect-ratio: 1; }
.market-row > .image-placeholder { width: 76px; height: 76px; border: 1px solid #c8d0c3; border-radius: 3px; }
.offer-item > .image-placeholder { width: 56px; height: 56px; border-radius: 3px; }
.frog-portrait > .image-placeholder { position: relative; z-index: 1; width: 100%; height: 100%; font-size: 88px; }
.puzzle-row > .image-placeholder { width: 66px; height: 66px; border-radius: 4px; }
.sheet-image.image-placeholder { width: 100%; aspect-ratio: 1; border: 3px solid #315c42; border-radius: 5px; }
.cabinet-cell.empty { aspect-ratio: .78; display: grid; place-items: center; border: 2px dashed #b8905a; border-radius: 4px; background: rgba(79, 49, 29, 0.58); color: #ead8ae; text-align: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.cabinet-cell.empty b { display: block; font-size: 23px; }
.cabinet-cell.empty span { font-size: 8px; }

/* Recipe book */
.recipe-area { min-height: calc(100dvh - 199px); padding: 11px; background: #eee2c4; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.collection-tile,
.recipe-tile { position: relative; min-width: 0; border: 2px solid #755039; border-radius: 4px; background: #fff6db; overflow: hidden; padding: 0 0 7px; text-align: left; color: var(--ink); box-shadow: 0 3px 0 rgba(80, 49, 29, 0.12); }
.collection-tile img,
.recipe-tile img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; background: #ccd7c2; }
.collection-tile b,
.recipe-tile b { display: block; padding: 5px 5px 1px; font: 800 9px/1.1 Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-tile small,
.recipe-tile small { display: block; min-height: 16px; padding: 0 5px; font-size: 7px; line-height: 1.25; color: #6b624f; }
.tile-pearl::before,
.market-pearl::before { content: " · "; }
.recipe-emoji { position: absolute; right: 4px; top: 4px; border-radius: 50%; padding: 3px; background: #fff; font-size: 11px; }
.recipe-listed { position: absolute; left: 4px; top: 4px; padding: 3px 4px; border-radius: 3px; background: #d8aa31; font-size: 6px; font-style: normal; font-weight: 900; }
.book-page { margin: 12px; padding: 15px 16px 18px; min-height: calc(100dvh - 176px); position: relative; background: var(--paper); border: 3px solid #563822; border-radius: 5px; box-shadow: inset 10px 0 0 rgba(107, 70, 40, 0.08), var(--shadow); }
.book-page::before { content: ""; position: absolute; left: 10px; top: 10px; bottom: 10px; border-left: 1px solid #d1b77c; }
.book-label { position: relative; text-align: center; color: #8e724c; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.book-page h2 { position: relative; margin: 6px 0 11px; text-align: center; font: 800 19px Georgia, serif; }
.book-image { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto; border: 3px solid #6d4c31; }
.book-image > :is(img, .image-placeholder) { width: 100%; height: 100%; object-fit: cover; }
.book-image > img { display: block; }
.book-image > span:not(.image-placeholder) { position: absolute; right: 7px; top: 7px; padding: 5px; border-radius: 50%; background: #fff; font-size: 18px; }
.formula { position: relative; margin: 11px 0 9px; padding: 10px; background: #f5e3ae; border: 1px solid #d7bd83; border-radius: 4px; font-size: 10px; line-height: 1.5; }
.formula b { display: block; margin-bottom: 3px; }
.book-meta { position: relative; margin-bottom: 10px; color: #735f41; font-size: 9px; }

/* Market */
.market-result { padding: 8px 11px 5px; color: var(--muted); font-size: 9px; }
.market-list { padding: 0 8px 14px; }
.market-row { width: 100%; min-height: 94px; display: grid; grid-template-columns: 78px minmax(0, 1fr) 72px; gap: 9px; align-items: center; padding: 8px 4px; border: 0; border-bottom: 1px solid #dfe3db; background: #fff; color: var(--ink); text-align: left; }
.market-row img { width: 76px; height: 76px; object-fit: cover; border: 1px solid #c8d0c3; border-radius: 3px; }
.market-row h3 { margin: 0 0 5px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-row p { margin: 0; color: #69746d; font-size: 8px; line-height: 1.45; }
.market-copy { min-width: 0; }
.market-origin { margin-top: 5px !important; color: #4c604f !important; display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.market-price { text-align: right; }
.market-price b { display: block; color: #184c31; font-size: 12px; }
.market-price small { display: block; margin: 5px 0; color: #7b827d; font-size: 7px; }
.market-price span { display: inline-block; padding: 5px 7px; border-radius: 3px; background: var(--gold); font-size: 7px; font-weight: 900; }

/* Guild */
.daily-quest-summary { margin: 12px; padding: 13px; border: 2px solid #597957; border-radius: 6px; background: #edf3e8; box-shadow: var(--shadow); }
.daily-quest-summary > div:first-child { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.daily-quest-summary > div:first-child b { color: var(--ink); }
.daily-quest-summary footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #c9d6c4; font-size: 9px; }
.daily-quest-list { display: grid; gap: 8px; padding: 0 12px; }
.daily-quest-card { min-height: 92px; display: grid; grid-template-columns: 35px minmax(0, 1fr) 55px; gap: 9px; align-items: center; padding: 10px; border: 1px solid #d7c58e; border-radius: 6px; background: #fff9e3; color: var(--ink); }
.daily-quest-card.done { border-color: #9fc397; background: #e2eedc; }
.daily-quest-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #ead8a3; font-weight: 900; }
.daily-quest-card.done .daily-quest-mark { background: #6b9b69; color: #fff; }
.daily-quest-copy { min-width: 0; }
.daily-quest-difficulty { color: #7c6847; font-size: 8px; font-weight: 900; }
.daily-quest-copy h3 { margin: 3px 0 7px; font-size: 10px; line-height: 1.3; }
.daily-quest-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.daily-quest-progress .meter { margin: 0; }
.daily-quest-progress b { font-size: 8px; }
.daily-quest-reward { color: var(--muted); font-size: 7px; text-align: right; }
.daily-quest-reward b { display: block; margin-top: 3px; color: var(--green); font-size: 10px; }
.daily-guild-entry { width: calc(100% - 24px); min-height: 65px; display: grid; grid-template-columns: 40px minmax(0, 1fr) 16px; gap: 9px; align-items: center; margin: 12px; padding: 9px 11px; border: 2px solid #785238; border-radius: 6px; background: var(--paper); color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.daily-guild-entry > span:first-child { font-size: 28px; text-align: center; }
.daily-guild-entry > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.daily-guild-entry b { font: 800 13px Georgia, serif; }
.daily-guild-entry small { color: var(--muted); font-size: 8px; }
.daily-guild-entry > span:last-child { color: var(--green); font-size: 20px; font-weight: 900; }
.guild-hero { margin: 12px; padding: 14px; background: var(--paper); border: 4px solid #785238; border-radius: 5px; box-shadow: var(--shadow); }
.guild-hero h2 { margin: 0; font: 800 19px Georgia, serif; }
.guild-hero p { margin: 6px 0 0; color: #6e5a3e; font-size: 10px; line-height: 1.45; }
.progress-line { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.progress-line .meter { flex: 1; background: #d7c896; }
.progress-line b { font-size: 10px; }
.order-list { padding: 0 12px 16px; }
.order-card { width: 100%; min-height: 98px; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 9px; padding: 11px; border: 1px solid #d8c58e; border-radius: 6px; background: #fff9e3; color: var(--ink); text-align: left; }
.order-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: #dce9d4; font-size: 27px; }
.order-card h3 { margin: 0 0 4px; font-size: 11px; }
.order-card p { margin: 0; color: #6d6857; font-size: 8px; line-height: 1.4; }
.order-state { font-size: 16px; }
.order-card.done { background: #e2eedc; border-color: #a9c79f; }
.offer-list { display: grid; gap: 8px; margin-top: 10px; }
.offer-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.offer-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 3px; }
.offer-item h4 { margin: 0 0 4px; font-size: 10px; }
.offer-item p { margin: 0; color: var(--muted); font-size: 8px; }
.offer-item .feed-weight { margin-top: 3px; color: var(--green); font-weight: 900; }

/* Frog */
.frog-portrait { position: relative; margin: 12px 12px 0; aspect-ratio: 1.15; overflow: hidden; border: 5px solid #315f44; border-radius: 7px; background: #9bc38f; box-shadow: var(--shadow); }
.frog-portrait::before { content: "🐸"; position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 30px; font-size: 88px; background: #9bc38f; }
.frog-portrait img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.frog-nameplate { position: absolute; z-index: 2; left: 10px; right: 10px; bottom: 10px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; background: rgba(255, 255, 255, 0.91); border-radius: 5px; }
.frog-nameplate > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.frog-nameplate b { font: 800 16px Georgia, serif; }
.frog-nameplate span { font-size: 9px; color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 12px; }
.stat-box { min-height: 68px; padding: 9px; background: #fff; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.stat-box span { display: block; font-size: 20px; }
.stat-box b { display: block; margin-top: 4px; font-size: 10px; }
.stat-box small { font-size: 7px; color: var(--muted); }
.jar-panel { margin: 0 12px 10px; padding: 12px 12px 15px; background: #e8eef1; border: 1px solid #bacbd3; border-radius: 6px; overflow: hidden; }
.jar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.jar-header h3 { margin: 0; font-size: 12px; }
.jar-header small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 800; }
.jar-meter { margin: 9px 0 15px; background: #cbd8dc; }
.jar-meter > i { background: #4f9b89; }
.jar-vessel { position: relative; width: min(100%, 276px); height: 178px; margin: 0 auto; overflow: hidden; border: 5px solid rgba(83, 123, 132, 0.72); border-top-width: 11px; border-radius: 16px 16px 45px 45px; background: rgba(255, 255, 255, 0.54); box-shadow: inset 8px 0 0 rgba(255, 255, 255, 0.32), inset -8px 0 0 rgba(87, 135, 144, 0.08), 0 7px 13px rgba(30, 71, 73, 0.12); }
.jar-vessel::before { content: ""; position: absolute; z-index: 4; width: 112px; height: 14px; left: calc(50% - 56px); top: -11px; border: 3px solid #42656b; border-radius: 4px; background: #adc3c5; }
.jar-vessel::after { content: ""; position: absolute; z-index: 3; left: 13px; top: 18px; bottom: 23px; width: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.58); }
.jar-fill { position: absolute; z-index: 0; left: 0; right: 0; bottom: 0; min-height: 4px; background: rgba(114, 187, 167, 0.2); transition: height .2s ease; }
.jar-insects { position: relative; z-index: 2; height: 100%; display: flex; align-content: center; align-items: center; justify-content: center; flex-wrap: wrap; gap: 9px; padding: 25px 27px 18px; }
.jar-insect { display: inline-flex; align-items: center; gap: 3px; min-height: 37px; padding: 5px 8px; border: 1px solid rgba(73, 105, 91, 0.28); border-radius: 18px; background: rgba(255, 255, 255, 0.82); font-size: 21px; box-shadow: 0 2px 5px rgba(31, 68, 57, 0.1); }
.jar-insect b { font-size: 9px; }
.jar-empty { color: var(--muted); font-size: 10px; font-weight: 800; }
.frog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 16px; }

.frog-gallery { padding: 12px 12px 18px; }
.frog-gallery-stage { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border: 4px solid #315f44; border-radius: 7px; background: #9bc38f; box-shadow: var(--shadow); touch-action: pan-y; }
.frog-gallery-stage > img,
.frog-gallery-stage > .image-placeholder { width: 100%; height: 100%; display: grid; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.frog-gallery-image { display: block; }
.frog-main-badge { position: absolute; z-index: 3; left: 10px; top: 10px; padding: 6px 9px; border-radius: 5px; background: rgba(23, 60, 45, 0.9); color: #fff; font-size: 9px; font-weight: 900; }
.frog-gallery-arrow { position: absolute; z-index: 3; top: calc(50% - 23px); width: 42px; height: 46px; display: grid; place-items: center; border: 0; background: rgba(255, 255, 255, 0.88); color: var(--deep); font-size: 31px; line-height: 1; box-shadow: 0 2px 9px rgba(18, 43, 29, 0.18); }
.frog-gallery-arrow.previous { left: 8px; }
.frog-gallery-arrow.next { right: 8px; }
.frog-gallery-details { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px 8px; }
.frog-gallery-details > div { min-width: 0; }
.frog-gallery-details b { display: block; font: 800 13px/1.25 Georgia, serif; }
.frog-gallery-details span { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; }
.frog-gallery-details strong { flex: 0 0 auto; padding: 6px 8px; border-radius: 5px; background: #e2eadf; font-size: 9px; }
.frog-main-note { min-height: 42px; display: grid; place-items: center; border: 1px solid #a9c7a7; border-radius: 5px; background: #e2efde; color: #285339; font-size: 9px; font-weight: 900; }
.frog-photo-thumbs { display: flex; gap: 8px; margin-top: 12px; padding: 2px 1px 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: #9fb49b #e1e8de; scrollbar-width: thin; }
.frog-photo-thumb { position: relative; width: 72px; height: 72px; flex: 0 0 72px; overflow: hidden; padding: 0; border: 3px solid transparent; border-radius: 5px; background: #cbd8c2; }
.frog-photo-thumb.selected { border-color: var(--green); }
.frog-photo-thumb img,
.frog-photo-thumb > .image-placeholder { width: 100%; height: 100%; display: grid; object-fit: cover; font-size: 25px; }
.frog-photo-thumb i { position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--deep); color: #fff; font-size: 9px; font-style: normal; }

/* Profile, settings, puzzles */
.profile-head { padding: 18px 14px; display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }
.avatar { width: 64px; height: 64px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #cfe2c5; border: 3px solid #5f845d; font-size: 34px; }
.avatar img,
.avatar > .image-placeholder { width: 100%; height: 100%; display: grid; object-fit: cover; font-size: 30px; }
.profile-head h2 { margin: 0; font: 800 18px Georgia, serif; }
.profile-head p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.menu-list { padding: 10px 12px; }
.menu-row { width: 100%; min-height: 58px; display: grid; grid-template-columns: 39px 1fr auto; gap: 10px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; padding: 8px 10px; }
.menu-row .menu-icon { font-size: 22px; }
.menu-row b { display: block; font-size: 11px; }
.menu-row small { color: var(--muted); font-size: 8px; }
.menu-row .arrow { color: #879087; font-size: 18px; }
.settings-group { margin: 12px; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.settings-group h2 { margin: 0; padding: 11px 12px 7px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.setting-row { min-height: 58px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.setting-row b { display: block; font-size: 11px; }
.setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.theme-setting-row { grid-template-columns: 1fr; }
.theme-choice { width: 100%; display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: #edf2e9; }
.theme-choice button { min-width: 0; min-height: 34px; border: 0; border-radius: 4px; padding: 5px 4px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 900; }
.theme-choice button.active { background: var(--surface); color: var(--deep); box-shadow: 0 1px 5px rgba(23, 48, 34, .14); }
.theme-choice button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.toggle { width: 42px; height: 24px; border: 0; border-radius: 13px; background: #c9d0ca; padding: 3px; }
.toggle i { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; }
.toggle.on { background: var(--green); }
.toggle.on i { transform: translateX(18px); }
.stats-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
.summary-box { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.summary-box span { color: var(--muted); font-size: 8px; }
.summary-box b { display: block; margin-top: 5px; font-size: 18px; }
.rating-bars { padding: 12px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bar-row { display: grid; grid-template-columns: 53px 1fr 26px; gap: 8px; align-items: center; margin: 7px 0; font-size: 8px; }
.bar { height: 8px; background: #e0e6dc; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); }
.puzzle-list { padding: 10px 12px 16px; }
.puzzle-row { min-height: 86px; display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.puzzle-row img { width: 66px; height: 66px; object-fit: cover; border-radius: 4px; }
.puzzle-row h3 { margin: 0 0 4px; font-size: 10px; }
.puzzle-row p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.rating { font-size: 10px; font-weight: 900; color: var(--green); }

/* Overlays */
.overlay-root:empty { display: none; }
.overlay-root { position: fixed; z-index: 90; inset: 0; display: flex; justify-content: center; align-items: flex-end; background: rgba(13, 29, 19, 0.64); }
.sheet { width: min(100%, 460px); max-height: min(86dvh, 760px); overflow-y: auto; padding: 12px 15px calc(18px + env(safe-area-inset-bottom)); background: #fff; border-radius: 14px 14px 0 0; box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.22); }
.listing-sheet { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.listing-sheet-scroll { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding-right: 1px; }
.listing-sheet-action { flex: 0 0 auto; margin: 8px -15px 0; padding: 9px 15px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #d3dbd0; background: #fff; box-shadow: 0 -7px 16px rgba(28, 58, 39, .1); }
.listing-sheet-action .price-display { margin: 0 0 8px; }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 3px; background: #cbd2cb; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.sheet-head h2 { min-width: 0; flex: 1; margin: 0; font: 800 18px Georgia, serif; }
.sheet-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #edf0eb; font-size: 19px; color: #506057; }
.sheet-image { width: 100%; aspect-ratio: 1; object-fit: cover; border: 3px solid #315c42; border-radius: 5px; background: #ccd7c2; }
.sheet-subtitle { margin: 7px 0 12px; color: var(--muted); font-size: 9px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 10px 0; }
.detail-grid.single { grid-template-columns: 1fr; }
.detail-cell { padding: 9px; background: #edf2e9; border-radius: 5px; font-size: 8px; }
.detail-cell b { display: block; margin-top: 3px; font-size: 12px; }
.item-population { display: block; min-height: 3em; margin: 10px 0; font-size: 12px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.item-discovery { margin: 10px 0; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.detail-text { margin: 10px 0; font-size: 10px; line-height: 1.55; }
.price-display { display: flex; align-items: end; justify-content: space-between; margin: 12px 0 9px; }
.price-display span { color: var(--muted); font-size: 9px; }
.price-display b { color: #1c5435; font-size: 19px; }
.confirm-box { margin: 10px 0; padding: 11px; background: #edf2e9; border-radius: 5px; font-size: 10px; line-height: 1.75; }
.confirm-box span { float: right; font-weight: 900; }
.field-label { display: block; margin: 10px 0 5px; font-size: 9px; font-weight: 900; }
.text-input,
.select-input { width: 100%; min-height: 42px; border: 1px solid #bdc9ba; border-radius: 5px; background: #fff; padding: 9px 10px; font-size: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; margin: 11px 0; font-size: 10px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--green); }
.checkbox-row span { min-width: 0; }
.checkbox-row b { display: block; }
.checkbox-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.warning { margin: 10px 0; color: #7a6040; font-size: 8px; line-height: 1.45; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state span { display: block; margin-bottom: 10px; font-size: 44px; }
.empty-state b { display: block; color: var(--ink); font-size: 13px; }

/* Item history */
.history-button { margin: 4px 0 10px; }
.history-hint { margin: 0 0 10px; padding: 9px 10px; border: 1px solid #d8dfd2; border-radius: 5px; background: #f4f7f1; color: var(--muted); font-size: 8px; line-height: 1.4; }
.history-preview { min-height: 92px; display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 11px; align-items: center; margin-bottom: 10px; padding: 7px; border: 1px solid #cdd9c9; border-radius: 6px; background: #edf3e9; }
.history-preview-image { width: 80px; height: 80px; display: grid; object-fit: cover; border: 2px solid #315c42; border-radius: 4px; }
.history-preview h3 { margin: 0 0 5px; font: 800 14px/1.2 Georgia, serif; }
.history-preview p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.history-tree { overflow-x: hidden; padding: 12px 9px 14px; border: 2px solid #735037; border-radius: 5px; background: #f5e8c4; }
.history-branch { min-width: 0; }
.history-node-wrap { width: 100%; min-width: 0; }
.history-node { position: relative; width: 100%; min-height: 65px; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 10px; border: 2px solid #9b7b50; border-radius: 5px; background: #fff9e5; color: var(--ink); text-align: left; box-shadow: 0 3px 0 rgba(80, 49, 29, .12); }
.history-node.root { border-color: #315c42; background: #e9f2e4; }
.history-node > span:first-child { font-size: 26px; text-align: center; }
.history-node-copy { min-width: 0; }
.history-node b { display: block; min-width: 0; font: 800 11px/1.2 Georgia, serif; overflow-wrap: anywhere; }
.history-node small { display: block; margin-top: 3px; color: #6f6858; font-size: 7px; line-height: 1.3; }
.history-node em { display: block; margin-top: 5px; color: #285c3c; font-size: 7px; font-style: normal; font-weight: 900; line-height: 1.3; }
.history-result-badge { position: absolute; top: 4px; right: 5px; padding: 2px 4px; border-radius: 3px; background: #315c42; color: #fff; font-size: 6px; font-style: normal; font-weight: 900; }
.history-node.selected { border-color: var(--green); background: #e2eedc; box-shadow: 0 0 0 2px rgba(47, 116, 80, .18); }
.history-node.missing { border-style: dashed; opacity: .72; }
.history-node.expandable { padding-right: 36px; }
.history-node-toggle { position: absolute; right: 9px; top: 50%; width: 20px; height: 20px; display: grid; place-items: center; transform: translateY(-50%); border: 1px solid #9b7b50; border-radius: 50%; background: #f5e8c4; color: #315c42; font-size: 15px; font-style: normal; font-weight: 900; line-height: 1; }
.history-node.expanded .history-node-toggle { background: #315c42; color: #fff; }
.history-pearl::before { content: " · "; }
.history-descent { min-width: 0; margin: 5px 0 0 4px; }
.history-children { min-width: 0; padding-left: 10px; border-left: 2px solid #8b714c; }
.history-child { position: relative; min-width: 0; padding: 5px 0 7px; }
.history-child::before { content: ""; position: absolute; left: -10px; top: 38px; width: 8px; border-top: 2px solid #8b714c; }
.history-child:last-child { padding-bottom: 0; }
.history-cycle { min-height: 38px; display: flex; align-items: center; padding: 7px 9px; border: 1px dashed #9b7b50; border-radius: 4px; background: #f7efd7; color: #6f6858; font-size: 7px; font-weight: 800; }
.history-loading { padding: 10px; color: var(--green); text-align: center; font-size: 9px; font-weight: 900; }

/* Dark theme */
html[data-theme="dark"] {
  --ink: #edf5ef;
  --muted: #a8b8ad;
  --deep: #9dd5b2;
  --green: #5eae7d;
  --moss: #789d61;
  --water: #315f57;
  --paper: #393121;
  --paper-dark: #55472d;
  --gold: #d9b852;
  --coral: #cf705f;
  --blue: #75a3ce;
  --surface: #17231c;
  --line: #35483c;
  --shadow: 0 10px 28px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] body {
  background-color: #0c1410;
  background-image: linear-gradient(rgba(7, 16, 11, .68), rgba(7, 16, 11, .68)), url("../Textures/green.jpg");
}

html[data-theme="dark"] .app-shell { background: #111b16; }
html[data-theme="dark"] .app-header,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .segmented,
html[data-theme="dark"] .cabinet-summary,
html[data-theme="dark"] .cabinet-guild-link,
html[data-theme="dark"] .daily-quest-summary,
html[data-theme="dark"] .daily-quest-card,
html[data-theme="dark"] .daily-guild-entry,
html[data-theme="dark"] .game-copy,
html[data-theme="dark"] .game-activity-entry,
html[data-theme="dark"] .hint-target,
html[data-theme="dark"] .alchemy-select-grid label > span,
html[data-theme="dark"] .jabyakovka-option,
html[data-theme="dark"] .game-history-row,
html[data-theme="dark"] .result-movie-link,
html[data-theme="dark"] .market-row,
html[data-theme="dark"] .offer-item,
html[data-theme="dark"] .profile-head,
html[data-theme="dark"] .menu-row,
html[data-theme="dark"] .settings-group,
html[data-theme="dark"] .summary-box,
html[data-theme="dark"] .rating-bars,
html[data-theme="dark"] .sheet,
html[data-theme="dark"] .listing-sheet-action,
html[data-theme="dark"] .text-input,
html[data-theme="dark"] .select-input { background: var(--surface); color: var(--ink); }

html[data-theme="dark"] .header-back,
html[data-theme="dark"] .header-action,
html[data-theme="dark"] .icon-button { border-color: #3d5547; background: #202f27; color: var(--deep); }
html[data-theme="dark"] .icon-button.active { background: #294b37; }
html[data-theme="dark"] .balance-pill { background: #294535; color: #d7f2df; }
html[data-theme="dark"] .nav-button { color: #a2b2a8; }
html[data-theme="dark"] .nav-button.active { background: #284433; color: #dff3e5; }
html[data-theme="dark"] .segment { border-color: #405448; background: #202d26; color: #aebdb3; }
html[data-theme="dark"] .segment.active { border-color: #75b68d; background: #315f43; color: #fff; }
html[data-theme="dark"] .toolbar { background: #1d2b23; border-color: var(--line); }
html[data-theme="dark"] .search-field { border-color: #405448; background: #111a15; color: var(--ink); }
html[data-theme="dark"] .search-field::placeholder,
html[data-theme="dark"] .text-input::placeholder { color: #819187; }
html[data-theme="dark"] .secondary-button { background: #29382f; color: #d5e4da; }
html[data-theme="dark"] .danger-button { background: #482c2a; color: #f1b2a9; }

html[data-theme="dark"] .game-picture,
html[data-theme="dark"] .image-placeholder,
html[data-theme="dark"] .jabyakovka-option-image { background: #2a3b31; color: #cce6d5; }
html[data-theme="dark"] .game-category,
html[data-theme="dark"] .game-transfer code,
html[data-theme="dark"] .market-origin,
html[data-theme="dark"] .market-price b,
html[data-theme="dark"] .price-display b { color: #9dd5b2 !important; }
html[data-theme="dark"] .game-answer-format { background: #39331f; color: #e5d7a8; }
html[data-theme="dark"] .game-transfer,
html[data-theme="dark"] .hint-target.primary-target,
html[data-theme="dark"] .alchemy-select-grid label input:checked + span { border-color: #4e765d; background: #233a2c; }
html[data-theme="dark"] .game-activity { border-color: var(--line); background: #111a15; }
html[data-theme="dark"] .game-activity-title { border-color: var(--line); }
html[data-theme="dark"] .game-activity-title span { background: #294535; }
html[data-theme="dark"] .game-activity-entry.near { background: #39351f; }
html[data-theme="dark"] .game-activity-entry.success { background: #203b2a; }
html[data-theme="dark"] .game-activity-entry.hint,
html[data-theme="dark"] .game-activity-entry.letters { background: #352f1e; }
html[data-theme="dark"] .game-activity-entry small { color: #c5d2c9; }
html[data-theme="dark"] .letter-grid button { border-color: #476052; background: #233229; color: var(--deep); }

html[data-theme="dark"] .meter,
html[data-theme="dark"] .bar { background: #2c3b32; }
html[data-theme="dark"] .recipe-area { background: #211d17; }
html[data-theme="dark"] .collection-tile,
html[data-theme="dark"] .recipe-tile { border-color: #8d6d4d; background: #342d20; }
html[data-theme="dark"] .collection-tile small,
html[data-theme="dark"] .recipe-tile small,
html[data-theme="dark"] .book-meta,
html[data-theme="dark"] .guild-hero p,
html[data-theme="dark"] .order-card p { color: #c4b99e; }
html[data-theme="dark"] .recipe-emoji,
html[data-theme="dark"] .book-image span { background: #202b24; }
html[data-theme="dark"] .book-label { color: #d2b982; }
html[data-theme="dark"] .book-page::before { border-color: #715f3d; }
html[data-theme="dark"] .formula { border-color: #715f3d; background: #4a3e25; }
html[data-theme="dark"] .market-row { border-color: var(--line); }
html[data-theme="dark"] .market-row p,
html[data-theme="dark"] .market-price small { color: var(--muted); }

html[data-theme="dark"] .guild-hero { border-color: #785c42; }
html[data-theme="dark"] .order-card { border-color: #685c3a; background: #302d1e; }
html[data-theme="dark"] .order-card.done { border-color: #477055; background: #213729; }
html[data-theme="dark"] .order-icon { background: #2c4435; }
html[data-theme="dark"] .frog-nameplate { background: rgba(20, 31, 25, .92); }
html[data-theme="dark"] .stat-box { border-color: var(--line); background: var(--surface); }
html[data-theme="dark"] .jar-panel { border-color: #405b63; background: #1b2a2d; }
html[data-theme="dark"] .jar-meter { background: #314348; }
html[data-theme="dark"] .jar-vessel { background: rgba(157, 205, 211, .12); box-shadow: inset 8px 0 0 rgba(255, 255, 255, .08), inset -8px 0 0 rgba(0, 0, 0, .12), 0 7px 13px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .jar-vessel::after { background: rgba(255, 255, 255, .16); }
html[data-theme="dark"] .jar-insect { border-color: rgba(158, 196, 174, .25); background: rgba(23, 35, 28, .82); }
html[data-theme="dark"] .frog-gallery-arrow { background: rgba(23, 35, 28, .9); }
html[data-theme="dark"] .frog-gallery-details strong { background: #29382f; }
html[data-theme="dark"] .frog-main-note { border-color: #477055; background: #213729; color: #bde0c8; }
html[data-theme="dark"] .frog-photo-thumbs { scrollbar-color: #486052 #1c2922; }

html[data-theme="dark"] .theme-choice { background: #111a15; }
html[data-theme="dark"] .theme-choice button.active { background: #2a3b31; color: #dff3e5; box-shadow: 0 1px 5px rgba(0, 0, 0, .3); }
html[data-theme="dark"] .toggle { background: #526157; }
html[data-theme="dark"] .toggle i { background: #dce8df; }
html[data-theme="dark"] .menu-row .arrow { color: #91a198; }
html[data-theme="dark"] .sheet-close { background: #29382f; color: #c8d8ce; }
html[data-theme="dark"] .sheet-handle { background: #526157; }
html[data-theme="dark"] .detail-cell,
html[data-theme="dark"] .confirm-box,
html[data-theme="dark"] .history-hint,
html[data-theme="dark"] .history-preview { border-color: var(--line); background: #202f27; }
html[data-theme="dark"] .warning { color: #d4b98d; }

html[data-theme="dark"] .history-tree { border-color: #755d40; background: #272218; }
html[data-theme="dark"] .history-node { border-color: #806947; background: #352e21; }
html[data-theme="dark"] .history-node.root,
html[data-theme="dark"] .history-node.selected { border-color: #548065; background: #23382b; }
html[data-theme="dark"] .history-node small,
html[data-theme="dark"] .history-cycle { color: #c2b79e; }
html[data-theme="dark"] .history-node em { color: #9dd5b2; }
html[data-theme="dark"] .history-node-toggle { border-color: #806947; background: #272218; color: #d9c59d; }
html[data-theme="dark"] .history-node.expanded .history-node-toggle { background: #426b51; color: #fff; }
html[data-theme="dark"] .history-children { border-color: #806947; }
html[data-theme="dark"] .history-child::before { border-color: #806947; }
html[data-theme="dark"] .history-cycle { border-color: #806947; background: #30291d; }

.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px); width: min(calc(100% - 28px), 420px); padding: 11px 14px; border-radius: 6px; background: #173c2d; color: #fff; text-align: center; font-size: 10px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100dvh - 36px); max-height: calc(100dvh - 36px); border-radius: 22px; }
  .app-header { top: 18px; border-radius: 22px 22px 0 0; }
  .bottom-nav { bottom: 18px; border-radius: 0 0 22px 22px; }
  .app-view { height: calc(100dvh - 36px); overflow-y: auto; }
}

@media (max-width: 360px) {
  .header-back + .header-title h1 { font-size: 14px; }
  .cabinet-grid,
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-row { grid-template-columns: 68px minmax(0, 1fr) 62px; }
  .market-row > :is(img, .image-placeholder) { width: 66px; height: 66px; }
}
