* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { font-family: Verdana, Geneva, sans-serif; font-size: 12px; background: #000; }
#game { position: relative; width: 100%; height: 100%; }
#viewport { position: absolute; inset: 0; display: block; }
.hidden { display: none !important; }

#action-text { position: absolute; top: 8px; left: 10px; font-size: 13px; font-weight: bold; color: #fff; text-shadow: 1px 1px 0 #000; pointer-events: none; }
#action-text .target { color: #6ee7e7; }
#action-text .verb { color: #fff; }

#xp-counter { position: absolute; top: 8px; right: 230px; color: #fff; font-weight: bold; text-shadow: 1px 1px 0 #000; background: rgba(0, 0, 0, 0.35); padding: 4px 10px; border: 1px solid #2b2118; }
#clock-line  { position: absolute; top: 34px; right: 230px; color: #fff; font-weight: bold; text-shadow: 1px 1px 0 #000; background: rgba(0, 0, 0, 0.35); padding: 4px 10px; border: 1px solid #2b2118; }

#sidebar { position: absolute; right: 8px; bottom: 8px; width: 264px; background: #3b3023; border: 3px solid #1e1812; box-shadow: inset 0 0 0 1px #5c4d36; user-select: none; }
#tab-strip { display: flex; background: #2b2118; }
#skill-guide-tabs { display: flex; background: #2b2118; }
#skill-guide-tabs .tab { font-size: 11px; color: #ffb83f; font-family: inherit; }
.tab { flex: 1; padding: 7px 0; font-size: 15px; background: #2b2118; border: 1px solid #1e1812; cursor: pointer; }
.tab.selected { background: #5c4d36; }
.tab.flash { animation: flash 0.4s 4 alternate; }
@keyframes flash { from { background: #5c4d36; } to { background: #c9a227; } }

.panel { min-height: var(--panel-h, 296px); color: #ffb83f; }
#panel-inventory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px; align-content: start; }
/* aspect-ratio (not fixed height) so slots grow with the resizable sidebar */
.slot { position: relative; background: #494034; border: 1px solid #2b2118; box-shadow: inset 1px 1px 0 #5c4d36; aspect-ratio: 5 / 4; display: flex; align-items: center; justify-content: center; }
/* Fish art is a 64×40 viewBox; fill the slot at native aspect so the
   field-guide detail reads. Percentages scale per container (bank/worn). */
.slot svg { width: 92%; height: auto; max-height: 92%; }

#panel-skills { padding: 12px; }
#reset-save { margin-top: 14px; background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 5px 9px; cursor: pointer; font-family: inherit; }
#reset-save:hover { background: #6d5b40; }



#chatbox { position: absolute; left: 8px; bottom: 8px; width: 470px; height: 128px; background: #d8ccb0; border: 3px solid #5c4d36; }
.hud-grip { position: absolute; width: 16px; height: 16px; z-index: 5; opacity: 0.5; }
.hud-grip:hover { opacity: 1; }
#sidebar-grip { top: -3px; left: -3px; cursor: nwse-resize; border-top: 3px solid #c9a227; border-left: 3px solid #c9a227; }
#chat-grip { top: -3px; right: -3px; cursor: nesw-resize; border-top: 3px solid #c9a227; border-right: 3px solid #c9a227; }
.win-grip { position: sticky; float: right; bottom: 0; margin-top: -16px; cursor: nwse-resize; border-bottom: 3px solid #c9a227; border-right: 3px solid #c9a227; }
#chat-messages { height: 100%; overflow-y: auto; padding: 5px 8px; color: #000; line-height: 1.5; }
.chat-line.level { color: #7d2331; font-weight: bold; }

#xp-drops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.xp-drop { position: absolute; color: #fff; font-weight: bold; text-shadow: 1px 1px 0 #000; animation: xp-rise 1.1s ease-out forwards; }
@keyframes xp-rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-60px); } }

#webgl-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #1e1812; color: #ffb83f; font-size: 15px; text-align: center; padding: 30px; }

#wallet { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: #2f261c; border-bottom: 1px solid #1e1812; }
#wallet svg { width: 16px; height: 16px; }
#wallet-amount { color: #ffd95c; font-weight: bold; text-shadow: 1px 1px 0 #000; }

/* container-type lets row icons scale with the window width (cqw units) */
.game-window { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 380px; max-height: 70%; overflow-y: auto; background: #3b3023; border: 3px solid #1e1812; box-shadow: inset 0 0 0 1px #5c4d36, 0 6px 24px rgba(0, 0, 0, 0.5); color: #ffb83f; z-index: 20; container-type: inline-size; }
.window-title { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #2b2118; font-weight: bold; text-shadow: 1px 1px 0 #000; }
.window-close { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; cursor: pointer; padding: 2px 7px; font-family: inherit; }
.window-close:hover { background: #8a3b2f; }

#shop-coins { padding: 8px 10px; color: #ffd95c; font-weight: bold; text-shadow: 1px 1px 0 #000; border-bottom: 1px solid #1e1812; }
.shop-row, .guide-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; color: #e8d9b0; }
.guide-section { padding: 8px 10px 4px; color: #ffb83f; font-weight: bold; text-shadow: 1px 1px 0 #000; border-bottom: 1px solid #1e1812; }
.shop-row svg, .guide-row svg { width: clamp(22px, 7cqw, 56px); height: auto; flex: none; }
.shop-name, .guide-name { flex: 1; }
.shop-price { color: #ffd95c; }
.shop-count { color: #98e598; }
.shop-row button { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 2px 6px; cursor: pointer; font-family: inherit; font-size: 11px; }
.shop-row button:hover:not(:disabled) { background: #6d5b40; }
.shop-row button:disabled { opacity: 0.4; cursor: default; }
/* An order you can fill right now reads green and its Deliver button lights up. */
.shop-order-row.order-ready { background: rgba(64, 160, 64, 0.22); box-shadow: inset 3px 0 0 #5fd35f; }
.shop-order-row.order-ready .shop-name { color: #b7f0b7; }
.shop-order-row.order-ready button:not(:disabled) { color: #c7ffc7; border-color: #3a6a3a; }
.shop-empty { padding: 12px 10px; color: #b8a888; }

#skill-guide-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }
#skill-guide-sub { padding: 8px 10px; color: #e8d9b0; border-bottom: 1px solid #1e1812; }
.guide-row.locked { opacity: 0.45; }
.guide-row.locked svg { filter: grayscale(1); }
.guide-level { width: 64px; }
.guide-level.req-locked { color: #ff6b5e; }
.guide-row.next-unlock { border-left: 3px solid #c9a227; background: #443827; }
.guide-xp, .guide-price { width: 56px; text-align: right; }
.guide-xp { color: #b8c8d8; }
.guide-price { color: #ffd95c; }


.slot.drag-over { outline: 2px solid #c9a227; outline-offset: -2px; }
#drag-ghost { position: fixed; width: 44px; height: 28px; pointer-events: none; z-index: 50; opacity: 0.85; }
#drag-ghost svg { width: 100%; height: 100%; }

#store-coins { padding: 8px 10px; color: #ffd95c; font-weight: bold; text-shadow: 1px 1px 0 #000; border-bottom: 1px solid #1e1812; }
.store-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: #e8d9b0; }
.store-row svg { width: clamp(26px, 8cqw, 60px); height: auto; flex: none; }
.store-name { flex: 1; }
.store-price { color: #ffd95c; width: 86px; text-align: right; }
.store-row button { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 3px 8px; cursor: pointer; font-family: inherit; font-size: 11px; }
.store-row button:hover { background: #6d5b40; }
.store-owned { color: #c9a227; font-weight: bold; }
.store-row.locked { opacity: 0.45; }
.store-locked-note { font-size: 11px; color: #b8a888; }
.store-blurb { font-size: 10px; color: #b8a888; }
.store-section { padding: 7px 10px 3px; color: #ffb83f; font-weight: bold; text-shadow: 1px 1px 0 #000; border-bottom: 1px solid #1e1812; }

.slot.tier-white { box-shadow: inset 0 0 0 2px #e8e0d0; }
.slot.tier-green { box-shadow: inset 0 0 0 2px #7fd17f; }
.slot.tier-blue { box-shadow: inset 0 0 0 2px #6fa8ff; }
.slot.tier-yellow { box-shadow: inset 0 0 0 2px #ffd95c; }
.slot.tier-red { box-shadow: inset 0 0 0 2px #ff6b5e; }
.chat-line.rare { color: #1a4f9c; font-weight: bold; }

#inspect-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }
#inspect { width: 280px; }
#inspect-body { padding: 14px; text-align: center; color: #e8d9b0; }
.inspect-icon { width: 148px; height: 96px; margin: 0 auto 8px; border: 3px solid #e8e0d0; background: #494034; display: flex; align-items: center; justify-content: center; }
.inspect-icon svg { width: 136px; height: 85px; }
.inspect-name { font-weight: bold; font-size: 14px; color: #ffb83f; text-shadow: 1px 1px 0 #000; }
.inspect-tier { font-weight: bold; margin: 2px 0 8px; text-shadow: 1px 1px 0 #000; }
.inspect-stats div { padding: 2px 0; }
.inspect-context { font-size: 11px; color: #b8a888; margin-top: 8px; }

.guide-range { width: 84px; text-align: right; color: #b8c8d8; font-size: 11px; }
.guide-trophy { width: 92px; text-align: right; color: #ffd95c; font-size: 11px; }
.guide-log { width: 110px; text-align: right; font-size: 10px; color: #b8a888; }
.guide-pip { font-size: 10px; }
.guide-hooknote { font-size: 10px; color: #ff6b5e; }
.guide-equipnote { display: block; font-size: 10px; color: #a0b8a0; }

.skill-row { display: flex; gap: 10px; align-items: center; padding: 6px 2px; cursor: pointer; }
.skill-row:hover .skill-level { color: #ffd95c; }
.skill-icon { font-size: 22px; }
.skill-level { font-weight: bold; color: #ffb83f; text-shadow: 1px 1px 0 #000; }
.skill-xpbar { width: 140px; height: 8px; background: #221b13; border: 1px solid #1e1812; margin: 5px 0; }
.skill-xpbar-fill { height: 100%; background: #2f9e44; }
.skill-xp-text { font-size: 11px; color: #e8d9b0; }

#cook-sub { padding: 8px 10px; color: #e8d9b0; border-bottom: 1px solid #1e1812; }
.cook-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; color: #e8d9b0; }
.cook-row svg { width: clamp(26px, 8cqw, 60px); height: auto; flex: none; }
.cook-row.locked { opacity: 0.5; }
.cook-name { flex: 1; font-size: 11px; }
.cook-values { width: 104px; text-align: right; color: #ffd95c; font-size: 11px; }
.cook-burn { width: 62px; text-align: right; color: #ff9d5e; font-size: 11px; }
.cook-need { font-size: 10px; color: #ff6b5e; }
.cook-busy { font-size: 11px; color: #ffd95c; }
.cook-row button { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 2px 8px; cursor: pointer; font-family: inherit; font-size: 11px; }
.cook-row button:hover { background: #6d5b40; }
.cook-row button:disabled { opacity: 0.5; cursor: default; }

.slot.cooked svg, .cooked-art svg { filter: sepia(0.7) saturate(0.8) brightness(0.92); }
.chat-line.burn { color: #8a4a2a; font-weight: bold; }
.chat-line.npc { color: #2a5a8a; }
#craft-sub { padding: 8px 10px; color: #e8d9b0; border-bottom: 1px solid #1e1812; }
#bank-panel { width: 420px; display: flex; flex-direction: column; }
#bank-panel .window-title, #bank-actions, #bank-group-actions { flex: none; }
#bank-meter { color: #98e598; font-weight: normal; font-size: 11px; margin-left: auto; margin-right: 10px; }
#bank-actions { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #1e1812; }
#bank-actions button, #bank-group-actions button { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 4px 9px; cursor: pointer; font-family: inherit; font-size: 11px; }
#bank-actions button:hover, #bank-group-actions button:hover:not(:disabled) { background: #6d5b40; }
#bank-group-actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid #1e1812; }
#bank-group-actions button:disabled { opacity: 0.45; cursor: default; }
#bank-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px; overflow-y: auto; min-height: 0; flex: 1; }
.bank-cell { cursor: pointer; }
.bank-cell.empty { cursor: default; opacity: 0.6; }
.bank-cell svg { width: 86%; height: auto; max-height: 86%; }
.bank-cell.selected { outline: 2px solid #c9a227; outline-offset: -2px; }
.note-badge { position: absolute; top: 1px; right: 2px; font-size: 9px; font-weight: bold; color: #ffd95c; text-shadow: 1px 1px 0 #000; pointer-events: none; }
.slot.note { background: #d8ccb0; }
.slot.note svg { width: 70%; height: auto; max-height: 70%; }
.inspect-icon.note { background: #d8ccb0; }
#shop-actions { padding: 8px 10px; border-bottom: 1px solid #1e1812; }
#shop-actions button { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 4px 9px; cursor: pointer; font-family: inherit; font-size: 11px; }
#shop-actions button:hover:not(:disabled) { background: #6d5b40; }
#shop-actions button:disabled { opacity: 0.45; cursor: default; }
#panel-tools { padding: 10px; }
#panel-tools h3 { color: #ffb83f; text-shadow: 1px 1px 0 #000; margin: 4px 0 8px; font-size: 12px; }
/* RS "Equip Your Character" cross: rod up top, line/reel/hook across,
   bait below, stone connector bars behind. fr columns + aspect-ratio
   slots scale with the resizable sidebar. */
#worn-slots {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    '.    rod  .   '
    'line reel hook'
    '.    bait .   ';
  gap: 10px 8px;
  position: relative;
  padding: 4px 2px;
}
#worn-slots::before {
  content: ''; position: absolute; left: 50%; top: 10%; bottom: 12%; width: 7px;
  transform: translateX(-50%); background: #2b2118;
  box-shadow: inset 1px 0 0 #5c4d36, inset -1px 0 0 #1a140d;
}
#worn-slots::after {
  content: ''; position: absolute; top: 46%; left: 6%; right: 6%; height: 7px;
  background: #2b2118;
  box-shadow: inset 0 1px 0 #5c4d36, inset 0 -1px 0 #1a140d;
}
.worn-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; position: relative; z-index: 1; }
.worn-cell[data-worn='rod'] { grid-area: rod; }
.worn-cell[data-worn='reel'] { grid-area: reel; }
.worn-cell[data-worn='line'] { grid-area: line; }
.worn-cell[data-worn='hook'] { grid-area: hook; }
.worn-cell[data-worn='attractant'] { grid-area: bait; }
/* Stone-bezeled square slots, RS style; fluid with the column width. */
.worn-cell .slot {
  width: 100%; max-width: 92px; aspect-ratio: 1 / 1;
  background: #3f3629; border: 2px solid #2b2118;
  box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12;
}
.worn-cell .slot.worn-empty { opacity: 0.5; }
.worn-cell:hover .worn-name { color: #ffd95c; }
.worn-cell:hover .slot { box-shadow: inset 2px 2px 0 #6d5b40, inset -2px -2px 0 #241c12, 0 0 0 1px #c9a227; }
/* keep the lure tier ring visible inside the stone bezel */
.worn-cell .slot.tier-white  { box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12, inset 0 0 0 2px #e8e0d0; }
.worn-cell .slot.tier-green  { box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12, inset 0 0 0 2px #7fd17f; }
.worn-cell .slot.tier-blue   { box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12, inset 0 0 0 2px #6fa8ff; }
.worn-cell .slot.tier-yellow { box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12, inset 0 0 0 2px #ffd95c; }
.worn-cell .slot.tier-red    { box-shadow: inset 2px 2px 0 #5c4d36, inset -2px -2px 0 #241c12, inset 0 0 0 2px #ff6b5e; }
.worn-label { font-size: 9px; color: #b8a888; text-transform: uppercase; }
.worn-name { font-size: 10px; color: #e8d9b0; text-align: center; }
.worn-cond { color: #9ab06a; }
.worn-cond-low { color: #d06a4a; }
#worn-info { margin-top: 10px; font-size: 11px; color: #e8d9b0; line-height: 1.45; }
.slot.item { background: #3f3a30; }

#context-menu { position: fixed; z-index: 60; min-width: 150px; background: #2b2118; border: 2px solid #1e1812; box-shadow: inset 0 0 0 1px #5c4d36, 0 4px 16px rgba(0, 0, 0, 0.5); }
#context-menu-title { padding: 4px 10px; color: #c9a227; font-size: 11px; border-bottom: 1px solid #1e1812; }
.menu-row { padding: 4px 10px; font-size: 12px; cursor: pointer; }
.menu-row:hover { background: #5c4d36; }
.menu-row .verb { color: #fff; }
.menu-row .target { color: #6ee7e7; }

#rodcraft-sub { padding: 8px 10px; color: #e8d9b0; border-bottom: 1px solid #1e1812; }
.rod-mat { display: inline-block; margin-right: 6px; font-size: 10px; color: #b8c8d8; }
.rod-mat.req-locked { color: #ff6b5e; }

#fight-banner { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); background: #3b3023; border: 3px solid #1e1812; box-shadow: inset 0 0 0 1px #5c4d36; color: #ffb83f; padding: 8px 14px; z-index: 15; display: flex; gap: 12px; align-items: center; font-weight: bold; }
#fight-drag { background: #5c4d36; color: #ffb83f; border: 1px solid #1e1812; padding: 4px 10px; cursor: pointer; font-family: inherit; }
#fight-drag.tight { background: #7d2331; }

