/* The same palette and touch targets serve the hero, mail and clan screens. */
:root {
  color-scheme:dark;
  --ink:#edf0e5;--muted:#abb7aa;--paper:#202c27;--gold:#dfbd79;
  --line:#435147;--dark:#131b19;--green:#42634e;--shadow:0 8px 24px #0003;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  color:var(--ink);background:var(--dark);font-size:14px;
}
* {box-sizing:border-box}
body {margin:0;min-height:100vh;background:radial-gradient(ellipse at 0 0,#67854d18,transparent 55%),radial-gradient(ellipse at 100% 55%,#a37a3c0a,transparent 60%),var(--dark)}
button,input,textarea,select {font:inherit}
button {cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background .15s,border-color .15s,transform .15s}
button:active:not(:disabled) {transform:translateY(1px)}
button:disabled {cursor:default;opacity:.5}
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {outline:3px solid var(--gold);outline-offset:3px}
button:hover:not(:disabled) {border-color:var(--gold)}
[hidden] {display:none!important}
.symbols {position:absolute;width:0;height:0;overflow:hidden}
.visually-hidden {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
h1,h2,h3,p,figure {margin:0}
.app {
  --page-left:max(16px,var(--tg-safe-area-inset-left,0px),env(safe-area-inset-left));
  --page-right:max(16px,var(--tg-safe-area-inset-right,0px),env(safe-area-inset-right));
  max-width:860px;margin:auto;
  padding-top:max(0px,calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px)),env(safe-area-inset-top));
  padding-bottom:max(24px,calc(var(--tg-safe-area-inset-bottom,0px) + var(--tg-content-safe-area-inset-bottom,0px)),env(safe-area-inset-bottom));
  padding-left:var(--page-left);padding-right:var(--page-right);
}
.hero-header {position:relative;isolation:isolate;overflow:hidden;color:var(--ink);background:linear-gradient(110deg,#021b14ed,#031b17d9 50%,#021a12ed),url('assets/village.jpg') center 14%/cover;border-top:1px solid #8e804e;border-bottom:1px solid #a68a51;box-shadow:inset 0 0 0 1px #d1b86a12}
.masthead {display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:12px;min-height:66px;padding:8px 0}
.round {display:grid;place-items:center;border:1px solid var(--line);background:#202b26;color:var(--gold);width:44px;height:44px;flex:none;font-size:24px;border-radius:12px}
.masthead .round {background:#041e17a6;border-color:#526b4c;border-radius:9px;box-shadow:inset 0 0 0 1px #d4b5670a}
.masthead .round:first-child {border-color:#cfb273;background:#051d16c9}
.masthead .round svg {width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.eyebrow {display:block;letter-spacing:.14em;font-size:10px;font-weight:700;line-height:1.5}
h1 {font-family:Georgia,serif;font-size:clamp(22px,6vw,34px);font-weight:700;line-height:1.05;overflow-wrap:anywhere;text-wrap:balance}
.language-picker {display:flex;justify-content:space-between;align-items:center;gap:12px;color:var(--ink);font-size:14px;margin:0 0 18px;padding:12px;border:1px solid var(--line);border-radius:12px}
.language-picker select {width:100%;max-width:200px;min-width:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#202b26;color:var(--ink);min-height:44px;font:inherit}
.language-picker select:disabled {opacity:.6}
.parchment {background:linear-gradient(125deg,#27362d,#202c27);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:16px}
.identity {padding:0 var(--page-right) 0 var(--page-left);margin-left:calc(-1 * var(--page-left));margin-right:calc(-1 * var(--page-right))}
.hero-avatar {position:relative;overflow:hidden;width:64px;height:64px;border:1px solid #d9c27c;border-radius:50%;background:#354432;box-shadow:0 0 0 2px #d8b5720a}
.appearance-picker {display:grid;grid-template-columns:64px minmax(0,1fr);gap:12px;align-items:center;margin-bottom:18px}
.appearance-picker .language-picker {flex-direction:column;align-items:stretch;gap:8px;margin:0;padding:0;border:0;border-radius:0}
.appearance-picker select {max-width:none}
.hero-avatar img,.hero-avatar>.helmet-layer,.hero-avatar>.chest-layer,.hero-avatar>.weapon-layer {position:absolute;left:-190%;top:-8%;width:450%;max-width:none;height:auto}
.hero-avatar[data-appearance="female"] img,.hero-avatar[data-appearance="female"]>.helmet-layer,.hero-avatar[data-appearance="female"]>.chest-layer,.hero-avatar[data-appearance="female"]>.weapon-layer {left:-180%;top:-23%}
.helmet-layer,.chest-layer,.weapon-layer {pointer-events:none;overflow:visible}
.helmet-layer.broken,.chest-layer.broken {filter:grayscale(1)}
.weapon-layer.broken .sword-art {filter:grayscale(1)}
.hero-name {min-width:0;text-align:center}
.nickname-button {display:block;width:100%;min-width:44px;min-height:44px;padding:0;border:0;border-radius:5px;background:none;color:inherit;text-align:center;font:inherit;overflow-wrap:anywhere}
.nickname-button #name {display:block;min-width:0;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-wrap:nowrap}
.nickname-button .level-line {font-family:system-ui,-apple-system,"Segoe UI",sans-serif}
.settings-nickname {width:100%;min-height:44px;margin:0 0 18px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#202b26;color:var(--gold);text-align:left}
.level-line {display:flex;justify-content:center;flex-wrap:wrap;gap:4px;color:#ebc574;font-size:14px;line-height:1.3;margin-top:3px;font-weight:500}
.level-line b {font-weight:500;font-variant-numeric:tabular-nums}
.vitals-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;max-width:650px;margin:0 auto}
.vital-card {display:grid;grid-template-columns:24px minmax(0,1fr);gap:2px 7px;align-content:center;align-items:center;min-width:0;min-height:44px;padding:4px 8px;border:1px solid #5a6344;border-radius:9px;background:linear-gradient(115deg,#08251cd9,#042218d9);box-shadow:inset 0 1px #ffffff05;text-align:left;color:var(--ink)}
.vital-card+.vital-card {margin-left:-1px}
.vital-icon {width:24px;height:24px;fill:currentColor;filter:drop-shadow(0 2px 3px #0002);flex:none}
.vital-card .vital-icon {grid-column:1;grid-row:1/3}
.vital-health .vital-icon {color:#ff173c}
.vital-experience .vital-icon {color:#f6c44e}
.vital-copy {grid-column:2;grid-row:1;min-width:0}
.vital-copy>b {display:block;font-size:12px;font-weight:500;line-height:1.2;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.vital-experience .vital-copy {text-align:right}
progress {appearance:none;-webkit-appearance:none;width:100%;min-width:0;height:8px;border:0;background:#183f30;border-radius:8px;display:block;overflow:hidden}
.vital-card progress {grid-column:2;grid-row:2}
progress::-webkit-progress-bar {background:#183f30;border-radius:8px}
progress::-webkit-progress-value {background:linear-gradient(90deg,#ff123d,#ff4730);border-radius:8px}
.hp::-moz-progress-bar {background:#ff303c}
.level-progress::-webkit-progress-value {background:linear-gradient(90deg,#efac29,#ffd16a)}
.level-progress::-moz-progress-bar {background:#f2bc51}
.resource-strip {display:flex;align-items:center;justify-content:center;gap:12px;min-width:0;min-height:46px;padding:0 0 2px}
.wallet {display:flex;align-items:center;gap:12px;min-width:0;max-width:330px}
.wallet-balance {display:flex;align-items:center;justify-content:center;gap:6px;min-width:44px;min-height:44px;padding:2px 0;border:0;border-radius:6px;background:none;color:var(--ink)}
.wallet-balance>span:last-child {min-width:0}
.wallet b {display:block;font-size:15px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;line-height:1.25}
.coin {width:24px;height:24px;object-fit:contain;flex:none;filter:drop-shadow(0 1px 2px #0007)}
.currency-unit {white-space:nowrap}
.inline-coin {display:inline-block;width:1.4em;height:1.4em;object-fit:contain;vertical-align:-.3em;margin-right:.18em;filter:drop-shadow(0 1px 1px #0007)}
.vital-ranking {position:relative;display:flex;flex:none;align-items:center;justify-content:center;gap:8px;min-width:0;min-height:44px;padding:2px 0 2px 14px;border:0;border-radius:0;background:none;color:var(--ink);text-align:left}
.vital-ranking::before {content:'';position:absolute;left:0;top:10px;bottom:10px;width:1px;background:linear-gradient(transparent,#c6a65f,transparent)}
.vital-ranking .vital-icon {color:#efbc4e}
.vital-ranking>b {font-size:17px;font-weight:600;line-height:1.2;white-space:nowrap;font-variant-numeric:tabular-nums}
.vital-chevron {color:#e5c67a;font-size:25px;line-height:1}
.section-label {display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--ink);padding:24px 2px 12px}
.section-label h2 {font-family:Georgia,serif;font-size:21px;font-weight:400}
.text-button {background:none;border:0;padding:10px 0;min-height:44px;color:var(--gold);font-size:12px;text-decoration:underline;text-underline-offset:4px;line-height:1.5}
.hero-board {display:block}
.hero-stage {position:relative;isolation:isolate;height:clamp(240px,64vw,460px);margin-top:12px}
.equipment {position:absolute;inset:0;z-index:2;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.55fr) minmax(0,1fr);grid-template-rows:repeat(4,minmax(0,1fr));gap:6px;min-width:0;pointer-events:none}
.slot {--slot-border:#6f886d;pointer-events:auto;border:2px solid var(--slot-border);border-radius:10px;background:linear-gradient(140deg,#082419f5,#03170ff5);color:#edf0e6;box-shadow:0 3px 8px #0006,inset 0 0 0 1px #cce8b312;position:relative;display:grid;grid-template-columns:minmax(0,.65fr) minmax(0,1.35fr);grid-template-rows:repeat(2,minmax(0,1fr));align-items:center;gap:1px 2px;padding:4px 3px;min-height:44px;min-width:0;text-align:left}
.slot:nth-child(odd) {grid-column:1}
.slot:nth-child(even) {grid-column:3}
.slot:nth-child(-n+2) {grid-row:1}
.slot:nth-child(n+3):nth-child(-n+4) {grid-row:2}
.slot:nth-child(n+5):nth-child(-n+6) {grid-row:3}
.slot:nth-child(n+7) {grid-row:4}
.slot svg,.nav-icon svg,.activity-icon svg {fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;display:block;flex:none}
.slot svg.slot-art {grid-column:1;grid-row:1/3;width:100%;height:100%;min-height:0;overflow:hidden;stroke:none;opacity:.5;filter:saturate(.55)}
.slot-effects {grid-column:2;grid-row:1/3;display:flex;flex-direction:column;justify-content:center;gap:3px;min-width:0}
.slot-effect {display:block;min-width:0}
.slot small {display:block;width:100%;font-size:clamp(9px,2.3vw,15px);line-height:1.1;overflow-wrap:anywhere;min-width:0;text-shadow:0 1px 3px #000}
.slot-bonus {display:block;font-size:clamp(9px,2.3vw,14px);line-height:1.15;min-height:1.15em;overflow-wrap:anywhere;color:#aebfae}
.slot.multiple-effects .slot-effects {gap:1px}
.slot.multiple-effects small,.slot.multiple-effects .slot-bonus {font-size:clamp(8px,2.05vw,13px)}
.slot .slot-mark {font-size:16px;position:absolute;right:4px;bottom:2px;color:var(--gold)}
.slot .slot-mark:empty {display:none}
.item-level {position:absolute;right:3px;top:3px;z-index:1;max-width:calc(100% - 6px);padding:2px 4px;border:1px solid #9c805088;border-radius:4px;background:#06130ff2;color:#f1d58e;font:600 10px/1.15 system-ui,sans-serif;white-space:nowrap;font-variant-numeric:tabular-nums;pointer-events:none;box-shadow:0 1px 3px #0008}
.slot .item-level {font-size:9px;right:2px;top:2px;padding:1px 3px}
.slot.equipped svg.slot-art {opacity:1;filter:drop-shadow(0 2px 2px #0008)}
.slot.equipped .slot-bonus {color:#f5dfac}
.slot.equipped {padding-top:18px;padding-bottom:1px}
.slot.multiple-effects small,.slot.multiple-effects .slot-bonus {line-height:1;min-height:0}
.slot.rarity-0 {--slot-border:#ccd1c1}
.slot.rarity-1 {--slot-border:#a4d887}
.slot.rarity-2 {--slot-border:#72b4ea}
.slot.rarity-3 {--slot-border:#bd8ee7}
.slot.rarity-4 {--slot-border:#e5a04d}
.slot.broken {--slot-border:#d9947d;color:#e6a58f}
.slot.broken svg.slot-art {filter:grayscale(1);opacity:.5}
.slot.broken .slot-bonus {color:#e6a58f}
.portrait {position:absolute;inset:0 calc((100% - 12px)/3.55 + 6px);display:block;overflow:hidden;border:1px solid #9d875999;border-radius:12px;background:linear-gradient(#07160d08,#07160d26),url('assets/village.jpg') center 55%/cover;pointer-events:none}
.portrait::after {content:'';position:absolute;inset:80% 0 0;background:linear-gradient(transparent,#0b1e1366)}
.portrait img,.portrait>.helmet-layer,.portrait>.chest-layer,.portrait>.weapon-layer {display:block;position:absolute;left:50%;bottom:3px;width:auto;max-width:none;height:94%;transform:translateX(-52.8%);filter:drop-shadow(0 4px 3px #0007)}
.portrait>.helmet-layer.broken,.portrait>.chest-layer.broken {filter:grayscale(1) drop-shadow(0 4px 3px #0007)}
.hero-stage[data-appearance="female"] .portrait img,.hero-stage[data-appearance="female"] .portrait>.helmet-layer,.hero-stage[data-appearance="female"] .portrait>.chest-layer,.hero-stage[data-appearance="female"] .portrait>.weapon-layer {transform:translateX(-50.6%)}
.stats {margin-top:12px;border:1px solid #bba064;border-radius:12px;background:linear-gradient(130deg,#062317,#021b12)}
.stats h3 {font-weight:400}
.stats-toggle {width:100%;min-height:54px;display:grid;grid-template-columns:28px minmax(0,1fr) 22px;align-items:center;gap:10px;border:0;border-radius:12px;background:none;color:var(--ink);padding:9px 12px;text-align:left}
.stats-toggle>span:nth-child(2) {font:21px/1.25 Georgia,serif;overflow-wrap:anywhere}
.stats-spark {color:#f3cb74;font-size:30px;line-height:1}
.stats-chevron {width:22px;height:22px;fill:none;stroke:var(--gold);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;transition:transform .18s}
.stats-toggle[aria-expanded="true"] .stats-chevron {transform:rotate(180deg)}
.stats-toggle[aria-expanded="true"] {border-radius:12px 12px 0 0}
.stats-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:0 6px 6px}
#stats,.stat-main {display:contents}
.stat {--stat-icon-size:clamp(16px,5vw,26px);display:grid;grid-template-columns:var(--stat-icon-size) minmax(0,1fr) minmax(0,1.2fr) 44px;grid-template-rows:auto auto auto;align-items:center;gap:1px;min-width:0;min-height:82px;padding:7px 4px;border:1px solid #365b44;border-radius:10px;background:linear-gradient(125deg,#062b1c,#031d13)}
.stat-icon {grid-column:1;grid-row:1/4;display:block;width:var(--stat-icon-size);height:var(--stat-icon-size);fill:currentColor;stroke:#294239;stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 2px 2px #0005)}
[data-stat="strength"] .stat-icon {color:#f23b43;stroke:#981627}
[data-stat="defense"] .stat-icon {color:#d6e5e9;stroke:#7095aa}
[data-stat="accuracy"] .stat-icon {color:#f24b3d;fill:none;stroke:currentColor;stroke-width:2.4}
[data-stat="agility"] .stat-icon {color:#39b85e;stroke:#146035}
[data-stat="endurance"] .stat-icon {color:#fb414b;stroke:#da2738}
.stat-name {grid-column:2/4;grid-row:1;align-self:end;font-size:11px;line-height:1.15;color:#d7e3d4;overflow-wrap:anywhere}
.stat-numbers {grid-column:2;grid-row:2/4;min-width:0;align-self:start}
.stat-value {display:block;font-size:22px;font-weight:700;line-height:1.05;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.stat-parts {display:block;font-size:11px;color:#8aa58a;line-height:1.25;margin-top:2px}
.stat-parts.has-bonus {color:#a6d68c}
.stat.compact-stack .stat-numbers {grid-column:2/4;grid-row:2;display:flex;align-items:baseline;flex-wrap:wrap;gap:4px}
.stat.compact-stack .stat-parts {margin-top:0}
.stat.compact-stack .stat-price {grid-column:2/4;grid-row:3;align-self:start}
.stat.is-maxed .stat-price {display:none}
.stat-price {grid-column:3;grid-row:2/4;align-self:center;display:flex;align-items:center;gap:2px;min-width:0;font-size:11px;color:#eff1e7;line-height:1.2}
.stat-price .coin {width:16px;height:16px}
.stat-price>span:last-child {min-width:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.plus {grid-column:4;grid-row:1/4;align-self:center;border:1px solid #c19f5c;background:linear-gradient(135deg,#514c2e,#293b24);color:#f4cf80;width:44px;height:44px;min-width:44px;min-height:44px;border-radius:8px;font-size:28px;line-height:1}
.critical-stat .stat-icon {color:#ffb832;stroke:#f45127;stroke-width:2}
.critical-stat .stat-name {grid-column:2/-1}
.critical-stat .stat-value {grid-column:2/-1;grid-row:2/4;align-self:start;font-size:24px}
.activity-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:16px}
.activity {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border:1px solid var(--line);border-radius:13px;background:#223329;color:var(--ink);text-align:center;min-width:0;min-height:100px}
.activity>span:nth-child(2) {min-width:0;width:100%}
.activity-icon {color:#b9c8a4}
.activity-icon svg {width:24px;height:24px}
.activity small {display:block;font-size:10px;color:var(--muted);margin-bottom:2px;overflow-wrap:anywhere}
.activity b {display:block;font-size:11px;font-weight:500;overflow-wrap:anywhere;line-height:1.4}
.activity .chevron {display:none}
.chevron {margin-left:auto;color:#b9c8a4;font-size:24px}
.activity.is-ready {border-color:#c2a86b;background:#514b2d}
.activity.is-ready small,.activity.is-ready .activity-icon,.activity.is-ready .chevron {color:#f2d49a}
.activity-battles.is-ready b {color:#f2d49a}
.activity-battles.is-ready {background:linear-gradient(135deg,#323829,#1b2c21)}
.activity-battles.is-ready small {color:var(--ink)}
.activity-battles .activity-icon svg {width:32px;height:32px}
@media(min-width:540px) {
  .activity {flex-direction:row;justify-content:flex-start;gap:10px;padding:14px 12px;text-align:left;min-height:80px}
  .activity>span:nth-child(2) {width:auto}
  .activity small {font-size:11px;margin-bottom:4px}
  .activity b {font-size:12px}
  .activity .chevron {display:block}
}
.hero-nav {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:18px 0 14px}
.hero-nav button {background:#202c27;border:1px solid var(--line);border-radius:13px;color:var(--ink);min-width:0;min-height:108px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;padding:14px 6px}
.nav-icon {height:28px;color:var(--gold);position:relative}
.nav-icon svg {width:28px;height:28px}
.hero-nav b {font-size:13px;font-weight:500;overflow-wrap:anywhere}
.hero-nav small {font-size:10px;line-height:1.5;color:var(--muted);text-align:center;overflow-wrap:anywhere}
.hero-nav button.has-unread {border-color:#b69d60;background:#383a27}
.hero-nav button.has-unread .nav-icon::after {content:'';width:7px;height:7px;position:absolute;right:-4px;top:-2px;border-radius:50%;background:#f0cd80;box-shadow:0 0 0 3px #383a27}
.hero-nav small.unread {color:#f0cd80;font-weight:700}
.game-menu {width:100%;min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #e2bd78;border-radius:13px;padding:16px 18px;background:linear-gradient(100deg,#dec087,#c4a363);box-shadow:var(--shadow);color:#273024;font-size:19px}
.game-menu span:nth-child(1) {font-size:13px;font-weight:750;letter-spacing:.1em}
.footer-links {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;margin-top:12px;gap:8px}
.footer-links>span {font-size:11px;color:var(--muted)}
.footer-links>span::before {content:'●';color:#9ab783;font-size:7px;vertical-align:2px;margin-right:6px}
footer {display:flex;justify-content:space-between;gap:12px;border-top:1px solid #43514788;padding-top:16px;margin-top:12px;color:var(--muted);font-size:10px;line-height:1.5}
.gate {padding:24px;margin-top:10px}
.gate .eyebrow {color:var(--gold)}
.gate h2 {margin:12px 0;font-family:Georgia,serif;font-size:24px}
.gate p {line-height:1.7;font-size:14px;white-space:pre-line;overflow-wrap:anywhere}
.gate button,.notice button {margin-top:16px;min-height:44px;border:1px solid #bea570;background:#d8bb7f;padding:12px 16px;border-radius:10px;color:#263025}
.notice {margin:12px 0;padding:14px;background:#3b3124;color:#f3d6a3;border:1px solid #9f8655;border-radius:11px;font-size:13px;line-height:1.6}
.notice button {margin-top:10px}
.notice p {overflow-wrap:anywhere}
dialog {border:1px solid #667153;border-radius:18px;padding:0;width:calc(100% - 24px);max-width:540px;background:#202c27;color:var(--ink);box-shadow:0 25px 90px #0009;overscroll-behavior:contain}
#sheet {max-height:calc(100dvh - max(24px,calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px))) - max(24px,calc(var(--tg-safe-area-inset-bottom,0px) + var(--tg-content-safe-area-inset-bottom,0px))))}
dialog::backdrop {background:#080f0bcc;backdrop-filter:blur(3px)}
.sheet-head {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line);background:#26352b;position:sticky;top:0;z-index:1}
.sheet-head .eyebrow {color:var(--gold)}
.sheet-head .round {background:#1b2821;border-color:var(--line)}
.sheet-content {padding:22px 18px 24px}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) {width:calc(100% - 48px);max-width:460px;border:2px solid #b58c42;border-radius:14px;background:#001d13;box-shadow:0 0 0 1px #e3ca7f55,inset 0 0 0 2px #486343,0 24px 90px #000b}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) .sheet-head {padding:6px 12px;background:linear-gradient(115deg,#002417,#001a11);border-bottom:1px solid #b58c42}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) .sheet-head>.eyebrow,#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) #sheet-title,#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) #screen-text,#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) #screen-buttons {display:none}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) .sheet-content {padding:0}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) #close-sheet {width:44px;height:44px;border:1px solid #b58c42;border-radius:8px;color:#f8d17f;background:#04251a;font-size:28px;line-height:1}
.activity-heading {display:flex;align-items:center;gap:8px;color:#f3ce80;font-family:Georgia,serif;font-size:clamp(18px,4.5vw,22px);font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.activity-heading svg {width:28px;height:28px;flex:none;filter:drop-shadow(0 2px 2px #0008)}
.mine-art {display:block;width:calc(100% - 16px);height:auto;aspect-ratio:1;object-fit:cover;object-position:center 55%;max-height:calc(100dvh - 250px - max(0px,calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px))) - var(--tg-safe-area-inset-bottom,0px));margin:6px 8px 0;border:1px solid #8e7b47;border-radius:10px}
.mine-controls {display:grid;gap:8px;padding:6px 20px 12px;background:linear-gradient(125deg,#002517,#00190f)}
.mine-timer {display:flex;align-items:center;justify-content:center;gap:10px;min-height:36px;color:#f4cf7e;font-family:Georgia,serif;font-size:clamp(20px,5vw,24px);font-weight:700;line-height:1.2;font-variant-numeric:tabular-nums}
.mine-timer::before,.mine-timer::after {content:"";height:1px;flex:1;background:linear-gradient(90deg,transparent,#2f5238)}
.mine-timer::after {transform:scaleX(-1)}
.mine-timer svg {width:20px;height:28px;flex:none}
.mine-timer img {width:36px;height:36px;object-fit:contain;flex:none;filter:drop-shadow(0 2px 2px #0008)}
.mine-work,.mine-back {width:100%;min-width:0;display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;border:1px solid #edc978;border-radius:10px;padding:6px 10px;color:#fff4d3;background:linear-gradient(#167633,#045221 55%,#00401c);font-family:Georgia,serif;font-size:clamp(16px,3.8vw,18px);font-weight:700;line-height:1.2;box-shadow:inset 0 0 0 1px #77b86a,0 3px 5px #0008;text-shadow:0 2px 2px #0008}
.mine-work svg {width:24px;height:24px;flex:none;filter:drop-shadow(0 2px 2px #0007)}
.mine-work:disabled {opacity:.78;cursor:default}
.mine-work.is-ready {background:linear-gradient(#347e34,#14652a 55%,#064a21)}
.mine-back {min-height:44px;border-color:#426647;border-radius:10px;background:#042319;box-shadow:inset 0 0 0 1px #74906c33;color:#e7e7d2;font-size:clamp(16px,3.8vw,18px);font-weight:400}
#sheet:is([data-page="mine"],[data-page="work"],[data-page="woodcut"],[data-page="hunt"]) .notice {margin:0 16px 14px}
.sheet-content h2 {font-family:Georgia,serif;font-size:24px;line-height:1.3;margin-bottom:16px;overflow-wrap:anywhere}
.screen-text {white-space:pre-wrap;line-height:1.75;font-size:14px;overflow-wrap:anywhere}
.screen-buttons {display:flex;flex-direction:column;gap:9px;margin-top:22px}
.button-row {display:grid;grid-template-columns:repeat(var(--columns,1),minmax(0,1fr));gap:8px}
.button-row.two {--columns:2}
.screen-buttons button {min-width:0;min-height:48px;text-align:center;background:linear-gradient(120deg,#3c5540,#324934);border:1px solid #6f8458;border-radius:10px;color:#f3eddb;padding:13px 12px;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.screen-buttons button.back {background:#26352b;color:#c6cfbd;border-color:var(--line)}
.screen-buttons button.confirm {background:linear-gradient(100deg,#d8bb7f,#c1a369);color:#273025;border-color:#e2c78f;font-weight:600}
.screen-buttons button.ranking-entry {white-space:pre-line;text-align:left;line-height:1.8;padding:14px 16px;min-height:76px;background:#283a2d;border-color:#75835e;color:#f1e7cb}
.input-row {display:flex;gap:8px;margin-top:8px}
#amount {font:inherit;min-width:0;flex:1;width:100%;padding:12px;background:#121e18;border:1px solid #6f7b60;border-radius:10px;color:var(--ink);resize:vertical;line-height:1.5}
#amount::placeholder {color:#a8b29e;opacity:1}
.input-row button {min-height:48px;border:1px solid #6f8458;border-radius:10px;background:#3c5540;color:var(--ink);padding:12px 16px;white-space:nowrap}
#input-form {margin:22px 0 0}
#input-form label {font-size:13px;color:var(--muted);line-height:1.5}
.message-input .input-row {flex-direction:column}
.message-input button {width:100%}
#input-form[data-mode="nickname"] .input-row {flex-direction:column}
#input-form[data-mode="nickname"] button {width:100%}
.appearance-help {margin:-8px 4px 20px;color:var(--muted);font-size:12px;line-height:1.6;overflow-wrap:anywhere}
@media(min-width:700px) {
  .app {--page-left:max(24px,var(--tg-safe-area-inset-left,0px));--page-right:max(24px,var(--tg-safe-area-inset-right,0px))}
  .slot {padding:8px 6px;border-radius:12px;gap:2px 6px}
  .slot small {font-size:16px}
  .slot-bonus {font-size:15px}
  .stat {min-height:88px;padding:10px 12px;gap:6px}
  .stat-name {font-size:13px}
  .stat-price {font-size:13px}
  .stat-value {font-size:24px}
  .plus {min-width:44px;min-height:44px}
  .activity b {font-size:14px}
  .hero-nav small {font-size:12px}
}
@media(max-width:369px) {
  .stat:not(.critical-stat) {grid-template-columns:18px minmax(0,1fr) 44px;gap:2px 4px}
  .stat:not(.critical-stat) .stat-name {grid-column:1/3;font-size:10.5px}
  .stat:not(.critical-stat) .stat-icon {grid-row:2/4}
  .stat:not(.critical-stat) .stat-numbers {grid-column:2;grid-row:2;display:flex;align-items:baseline;flex-wrap:wrap;gap:3px}
  .stat:not(.critical-stat) .stat-value {white-space:nowrap}
  .stat.compact-stack .stat-value {font-size:18px}
  .stat:not(.critical-stat) .stat-parts {margin-top:0}
  .stat:not(.critical-stat) .stat-price {grid-column:2;grid-row:3;align-self:start}
  .stat:not(.critical-stat) .plus {grid-column:3}
  .activity {padding:10px 6px;gap:6px}
  .chevron {display:none}
  .hero-nav {grid-template-columns:repeat(2,minmax(0,1fr))}
  .hero-nav button {min-height:98px}
  .hero-nav small {font-size:11px}
}
@media(min-width:760px) {
  .masthead {grid-template-columns:54px minmax(0,1fr) 54px;min-height:82px}
  .masthead .round {width:54px;height:54px}
  .level-line {font-size:17px}
  .vital-card {min-height:52px;grid-template-columns:30px minmax(0,1fr);padding:5px 12px}
  .vital-card .vital-icon {width:30px;height:30px}
  .vital-copy>b {font-size:15px}
  .resource-strip {gap:20px;min-height:52px}
  .wallet {gap:24px}
  .wallet b,.vital-ranking>b {font-size:20px}
  .coin,.vital-ranking .vital-icon {width:30px;height:30px;font-size:23px}
  .vital-ranking {padding-left:20px;gap:12px}
}
@media(max-width:359px) {
  .slot {padding:4px 1px;gap:1px}
  .slot:not(.equipped) small {font-size:8px}
  .masthead {gap:8px}
  .vital-card {gap:2px 5px;padding:4px 6px}
  .resource-strip,.wallet {gap:10px}
  .wallet-balance {gap:4px}
  .wallet b {font-size:13px}
  .vital-ranking {gap:6px;padding-left:10px}
  .vital-ranking>b {font-size:15px}
}
@media(prefers-reduced-motion:reduce) {button,.stats-chevron {transition:none}}

.work-art,.woodcut-art {aspect-ratio:3/2;object-position:center;max-height:calc(100dvh - 300px - max(0px,calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px))) - var(--tg-safe-area-inset-bottom,0px))}
.work-duration {position:relative;width:100%;max-width:260px;justify-self:center}
.work-duration select {width:100%;min-width:0;min-height:44px;padding:8px 38px 8px 14px;appearance:none;border:1px solid #b58c42;border-radius:10px;background:#04291b;color:#f4e7bb;font:400 clamp(16px,3.8vw,18px)/1.25 Georgia,serif;cursor:pointer}
.work-duration select:disabled {opacity:.7;cursor:default}
.work-duration select option {background:#04291b;color:#f4e7bb}
.work-duration>svg {position:absolute;width:18px;height:18px;right:12px;top:50%;transform:translateY(-50%);pointer-events:none;fill:none;stroke:#f3ce80;stroke-width:2.5}

#woodcut-heading {min-width:0;font-size:clamp(14px,3.9vw,20px);letter-spacing:.01em}
#woodcut-title {white-space:nowrap}
#woodcut-reward .woodcut-logs {width:36px;height:36px;filter:drop-shadow(0 2px 2px #0008)}

#hunt-heading {min-width:0;font-size:clamp(16px,4.3vw,20px);letter-spacing:.015em;line-height:1.15}
.activity-heading img {width:28px;height:28px;object-fit:contain;flex:none}
.mine-work img {width:24px;height:24px;object-fit:contain;flex:none}
.materials-art {aspect-ratio:3/2;object-fit:contain;object-position:center}
.hunt-chances {margin:0;text-align:center;color:#b5c3a6;font-size:12px;line-height:1.4}
.hunt-rewards {display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;min-height:40px;color:#f4cf7e;font-family:Georgia,serif;font-size:clamp(16px,4vw,20px);font-weight:700}
.hunt-drop {display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:4px 7px;border:1px solid #7a7645;border-radius:9px;background:#073120;white-space:nowrap}
.hunt-drop img {width:40px;height:40px;object-fit:contain;filter:drop-shadow(0 2px 2px #0008)}
.hunt-empty {font-family:system-ui,sans-serif;font-size:14px;line-height:1.45;text-align:center;font-weight:400}

/* The supplied frame is nine-sliced: its painted slots are replaced by a
   responsive, interactive grid. Only the outer decorative edge is sampled. */
#sheet[data-page="bag"] {width:calc(100% - 20px);max-width:650px;max-height:calc(100dvh - 24px - var(--tg-safe-area-inset-top,0px) - var(--tg-content-safe-area-inset-top,0px) - var(--tg-safe-area-inset-bottom,0px));border:1px solid #9f7a42;border-radius:16px;background:#071411;box-shadow:0 22px 80px #000c,inset 0 0 0 2px #9b713d55}
#sheet[data-page="bag"] .sheet-head {gap:8px;padding:10px 12px;background:linear-gradient(110deg,#4b2f1e,#261d16 62%,#19221b);border-bottom:1px solid #9b713d}
#sheet[data-page="bag"] .sheet-head>.eyebrow,#sheet[data-page="bag"] #sheet-title,#sheet[data-page="bag"] #screen-text,#sheet[data-page="bag"] #screen-buttons {display:none}
#sheet[data-page="bag"] .sheet-content {padding:0 10px 12px}
#sheet[data-page="bag"] #close-sheet {flex:none;width:44px;height:44px;min-height:44px;padding:0;border:1px solid #bb9552;border-radius:9px;background:#05251b;color:#ffdc88;font-size:30px;line-height:1}
.bag-heading {display:flex;align-items:center;flex:1;min-width:0;gap:6px;color:#f8d58b}
.bag-illustration {width:clamp(56px,16vw,86px);height:78px;flex:none;object-fit:contain;filter:drop-shadow(0 3px 3px #0007)}
.bag-title-block {min-width:0;flex:1}
.bag-title-block h2 {font-family:Georgia,serif;font-size:clamp(22px,6vw,32px);line-height:1.1;text-transform:uppercase;margin:0;letter-spacing:.025em}
.bag-title-block small {display:block;color:#c9b291;font-size:11px;line-height:1.4;margin-top:5px}
.bag-capacity {display:flex;align-items:center;justify-content:center;gap:5px;flex:none;min-height:44px;padding:6px 8px;border:1px solid #9b7844;border-radius:8px;background:#081714;color:#f8e5b6;font-size:15px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.bag-capacity svg {width:19px;height:22px;fill:none;stroke:#eac078;stroke-width:1.8}
.bag-wallet {display:flex;justify-content:flex-end;align-items:center;gap:16px;min-height:42px;padding:2px 8px}
.bag-wallet button {display:flex;align-items:center;gap:6px;min-height:40px;padding:3px;border:0;box-shadow:none;background:transparent;color:#efe4c4;font-size:14px;font-variant-numeric:tabular-nums}
.bag-wallet img {width:24px;height:24px;object-fit:contain}
.bag-tabs {display:flex;gap:5px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:#7e653b #0b1a16;padding:2px 1px 8px;scroll-snap-type:x proximity}
.bag-tabs button {flex:1 0 82px;scroll-snap-align:start;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:66px;padding:8px 6px;border:1px solid #655139;border-radius:8px;background:linear-gradient(#14211e,#0a1715);color:#b9c1b4;font-family:Georgia,serif;font-size:12px;white-space:nowrap;box-shadow:inset 0 0 0 1px #0007}
.bag-tabs button[aria-selected="true"] {color:#ffe6a3;border-color:#e5b75a;background:linear-gradient(#755125,#44341e);box-shadow:inset 0 0 0 1px #dcb25866,0 0 9px #dbad4322}
.bag-tabs svg {width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
.bag-tabs button:first-child svg {fill:currentColor;stroke:none}
.bag-feedback {margin:4px 4px 10px;padding:9px 10px;border:1px solid #51714b;border-radius:8px;color:#d9e7bf;font-size:13px;line-height:1.4;white-space:pre-wrap}
.bag-frame {border:15px solid #a2763f;border-image:url('assets/bag-frame.webp?v=0.45.0') 52 50 52 50 / 15px / 0 stretch;background:#07120f;padding:6px;margin:0 1px}
.bag-grid {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;outline-offset:3px}
.bag-cell {--bag-border:#ad8b4c;position:relative;display:flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:44px;aspect-ratio:1;padding:4px;overflow:hidden;border:1.5px solid var(--bag-border);border-radius:8px;background:radial-gradient(ellipse at 50% 75%,#3d2c1a44,transparent 75%),linear-gradient(#121a19,#070e0e);box-shadow:inset 0 0 0 1px #d4ae5a22,0 2px 3px #0009}
.bag-cell.rarity-0 {--bag-border:#aab0a9}
.bag-cell.rarity-1 {--bag-border:#66b647}
.bag-cell.rarity-2 {--bag-border:#4cc1f2;background:radial-gradient(ellipse at 50% 65%,#123965,#07121b 85%)}
.bag-cell.rarity-3 {--bag-border:#bb74eb;background:radial-gradient(ellipse at 50% 65%,#37214e,#100c1a 85%)}
.bag-cell.rarity-4 {--bag-border:#f0b640;background:radial-gradient(ellipse at 50% 65%,#4f3215,#1b1309 85%)}
.bag-art {display:block;width:100%;height:100%;min-width:0;min-height:0;object-fit:contain;pointer-events:none}
.bag-symbol {width:66%;height:66%;color:#d9b67a;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.bag-cell[data-item="essence"] .bag-symbol {color:#bc9aff;filter:drop-shadow(0 0 4px #9d65ea77)}
.bag-cell[data-item="boss_heart"] .bag-symbol {color:#d76158}
.bag-quantity {position:absolute;right:3px;bottom:3px;max-width:94%;overflow:hidden;text-overflow:ellipsis;padding:1px 4px;border-radius:5px;background:#030909e6;color:#f4f3e6;font-size:12px;font-weight:700;line-height:1.25;font-variant-numeric:tabular-nums;pointer-events:none}
.bag-durability {position:absolute;left:3px;top:3px;padding:1px 3px;border-radius:4px;background:#0b1010e6;color:#decda5;font-size:9px;line-height:1.2}
.bag-cell.is-broken .bag-art {opacity:.45;filter:grayscale(.6)}
.bag-cell.is-broken .bag-durability {color:#ff8f81}
.gear-preview {--gear-border:#aab0a9;position:relative;display:flex;align-items:center;justify-content:center;width:clamp(150px,48vw,230px);aspect-ratio:1;margin:14px auto;padding:14px;border:2px solid var(--gear-border);border-radius:14px;background:radial-gradient(ellipse at 50% 65%,#34443a,#07140e 85%);box-shadow:inset 0 0 0 2px #c9ad6730,0 5px 18px #0007}
.gear-preview .bag-art {width:100%;height:100%;filter:drop-shadow(0 3px 5px #0009)}
.gear-preview .item-level {font-size:13px;right:7px;top:7px;padding:3px 6px}
.gear-preview.rarity-1 {--gear-border:#66b647}
.gear-preview.rarity-2 {--gear-border:#4cc1f2;background:radial-gradient(ellipse at 50% 65%,#123965,#07121b 85%)}
.gear-preview.rarity-3 {--gear-border:#bb74eb;background:radial-gradient(ellipse at 50% 65%,#37214e,#100c1a 85%)}
.gear-preview.rarity-4 {--gear-border:#f0b640;background:radial-gradient(ellipse at 50% 65%,#4f3215,#1b1309 85%)}
.gear-preview.is-broken .bag-art {opacity:.6;filter:grayscale(1)}
#sheet[data-page="worn_gear"] #sheet-title,#sheet[data-page="gearcard"] #sheet-title {font-size:22px;line-height:1.3}
#sheet[data-page="worn_gear"] #screen-text {font-size:14px;line-height:1.6;margin:14px 0}
#sheet .gear-actions button {min-height:52px;padding:12px 6px;border-color:#ac8b4e;background:linear-gradient(#294d2b,#14351e);font-size:13px}
#sheet .gear-actions .gear-repair-full {background:#14241c;color:#8e9c89;border-color:#465742;opacity:.65}
.bag-free {--bag-border:#53685d;background:linear-gradient(#0d1c16,#081510);box-shadow:inset 0 0 0 1px #82958b22}
.bag-upgrade {--bag-border:#c39a51;border-style:dashed;background:radial-gradient(ellipse at 50% 65%,#58432255,#101b12 85%);color:#edc77c}
.bag-upgrade>svg {width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.bag-reserved {--bag-border:#625a3e;background:repeating-linear-gradient(135deg,#171d16,#171d16 7px,#1c2219 7px,#1c2219 14px);box-shadow:none}
.bag-reserved>svg {width:25px;height:25px;fill:none;stroke:#a69362;stroke-width:1.8}
.bag-empty {grid-column:1/-1;display:grid;align-items:center;min-height:145px;margin:0;text-align:center;font-size:14px;line-height:1.5;color:#a8b6a4}
.bag-pagination {display:flex;align-items:center;justify-content:center;gap:14px;margin:0 0 8px;color:#c5b58d;font-size:12px}
.bag-pagination button {min-width:44px;min-height:44px;padding:2px 10px;border:1px solid #655638;border-radius:7px;background:#10221a;color:#e7c57b;font-size:26px;line-height:1}
.bag-pagination button:disabled {opacity:.3}
.bag-over {margin:8px 4px;color:#f0bc79;font-size:12px;line-height:1.5;text-align:center}
@media(min-width:400px) {.bag-grid {grid-template-columns:repeat(5,minmax(0,1fr))}.bag-tabs button {flex-basis:86px}}
@media(max-width:350px) {.bag-title-block h2 {font-size:21px}.bag-illustration {width:48px;height:66px}.bag-capacity {padding:5px;font-size:13px}.bag-capacity svg {display:none}.bag-heading {gap:4px}.bag-cell {padding:2px}.bag-frame {padding:4px}.bag-grid {gap:5px}}

.bag-capacity {max-width:110px}
.bag-capacity span {min-width:0;overflow:hidden;text-overflow:ellipsis}
.bag-wallet button {min-width:0;max-width:47%}
.bag-wallet b {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bag-wallet img {flex:none}
