/* Bumpkin Legends - interfaccia del gioco (sopra il kit di Sunflower in sfl.css) */
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b1d24; touch-action: none; }
body.sfl-font { font-size: 22px; line-height: 18px; color: #fff; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }
button { font-family: inherit; cursor: pointer; }
.sfl-font .num { font-family: "SflSecondary", monospace; }

/* sfl.css imposta 30px su ".sfl-font button/input": qui le misure del gioco hanno la precedenza */
.sfl-font .btn { font-size: 20px; line-height: 18px; }
.sfl-font .btn.big { font-size: 26px; }
.sfl-font .tab { font-size: 20px; line-height: 18px; }
.sfl-font .win-tabs .tab { font-size: 18px; }
.sfl-font .field { font-size: 22px; line-height: 22px; }
.sfl-font #zoom button { font-size: 22px; line-height: 20px; padding: 0; }
.sfl-font #chat input, .sfl-font .detail input, .sfl-font .list input { font-size: 18px; line-height: 18px; }
.sfl-font .win-head .x { font-size: 0; }

/* ---------- accesso ---------- */
#login { display: flex; align-items: center; justify-content: center; padding: 16px; background: #3e7a3a; }
#login-bg { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#login::before { content: ""; position: fixed; inset: 0; z-index: 1; background: radial-gradient(ellipse at center, rgba(0,0,0,.05), rgba(0,0,0,.6)); }
.login-box { z-index: 2; }
.login-box { position: relative; width: 100%; max-width: 380px; }
.login-in { padding: 18px 16px; text-align: center; color: var(--sfl-text); }
.login-in h1 { margin: 6px 0 8px; font-size: 40px; line-height: 34px; color: #3e2731; text-shadow: 2px 2px 0 #f7c78d; }
.login-in p { margin: 0 0 14px; color: #5a3b2e; }
.login-logo { width: 56px; height: 56px; image-rendering: pixelated; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; padding: 8px 4px; font-size: 20px; background: #b96f50; color: #fff; border: 0; border-radius: 6px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.tab.on { background: #3e8948; }
.field { display: block; width: 100%; margin: 0 0 8px; padding: 10px; font: inherit; font-size: 22px; border: 3px solid #3e2731; border-radius: 6px; background: #fff7e8; color: #3e2731; outline: none; }
.err { min-height: 20px; margin-top: 8px; color: #b3261e; font-size: 20px; }

/* ---------- bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; font-size: 20px; line-height: 18px; color: #fff;
  background: #3e8948; border: 3px solid #1f4723; border-radius: 6px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.25); text-shadow: 1px 1px 0 rgba(0,0,0,.4); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.btn.big { width: 100%; padding: 11px; font-size: 26px; }
.btn.red { background: #c0392b; border-color: #6b1a12; }
.btn.blue { background: #2f7fd6; border-color: #133b6b; }
.btn.gold { background: #e3a216; border-color: #6e4a00; }
.btn.gray { background: #7d6f6a; border-color: #3d3532; }
.btn[disabled] { opacity: .5; filter: grayscale(.6); pointer-events: none; }
.btn img { width: 20px; height: 20px; image-rendering: pixelated; }

/* ---------- gioco ---------- */
#cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.panel { background: rgba(62, 39, 49, .86); border: 3px solid #1d1216; border-radius: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.35); }

/* scheda del personaggio */
#me { position: absolute; left: 8px; top: calc(8px + env(safe-area-inset-top)); padding: 6px 8px; display: flex; gap: 8px; align-items: center; min-width: 210px; }
#me .face { width: 44px; height: 44px; background: #c28569 url("/sfl/hud/profile_bg.png") center / cover; border: 2px solid #1d1216; border-radius: 6px; overflow: hidden; position: relative; image-rendering: pixelated; }
#me .face canvas { position: absolute; left: -26px; top: -12px; width: 96px; height: 64px; image-rendering: pixelated; }
#me .lv { position: absolute; right: -2px; bottom: -2px; background: #e3a216; color: #3e2731; font-size: 16px; padding: 1px 4px; border-radius: 4px; border: 2px solid #3e2731; }
#me .info { flex: 1; min-width: 0; }
#me .nm { font-size: 20px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 13px; background: #1d1216; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; transition: width .2s; }
.bar b { position: absolute; inset: 0; text-align: center; font-family: "SflSecondary", monospace; font-weight: normal; font-size: 11px; line-height: 13px; color: #fff; text-shadow: 1px 1px 0 #000; }
.bar.hp i { background: linear-gradient(#ff6b5b, #d0302a); }
.bar.xp i { background: linear-gradient(#6ec5ff, #2f7fd6); }
.bar.boss { height: 18px; } .bar.boss i { background: linear-gradient(#ff7b3a, #b8241c); } .bar.boss b { font-size: 13px; line-height: 18px; }

/* valute */
#money { position: absolute; right: 8px; top: calc(8px + env(safe-area-inset-top)); padding: 5px 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
#money div { display: flex; align-items: center; gap: 5px; font-size: 20px; }
#money img { width: 20px; height: 20px; image-rendering: pixelated; }

/* bersaglio */
#target { position: absolute; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 5px 10px; width: min(260px, 46vw); text-align: center; }
#target .nm { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bosshud { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 6px 10px; width: min(420px, 92vw); text-align: center; }
#bosshud .row { display: flex; justify-content: space-between; align-items: center; font-size: 18px; margin-bottom: 4px; }

/* barra delle azioni */
#bar { position: absolute; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; }
.act { position: relative; width: 76px; height: 58px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; line-height: 12px; white-space: nowrap; overflow: hidden;
  color: #fff; background: #b96f50; border: 3px solid #3e2731; border-radius: 10px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.2); }
.act img { width: 26px; height: 26px; image-rendering: pixelated; }
#bar .act span { font-size: 16px; line-height: 14px; }
.act:active { transform: translateY(2px); }
.act.on { background: #3e8948; animation: glow 1.4s ease-in-out infinite; }
.act.hunt { width: 80px; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px #b6f07a, inset 0 -4px 0 rgba(0,0,0,.25); } }
.act .dot { position: absolute; right: -4px; top: -4px; min-width: 18px; height: 18px; padding: 0 3px; font-size: 12px; line-height: 15px; background: #c0392b; border: 2px solid #3e2731; border-radius: 9px; }

/* zoom */
#zoom { position: absolute; right: 8px; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; padding: 4px; }
#zoom button { width: 34px; height: 34px; font-size: 22px; color: #fff; background: #b96f50; border: 2px solid #3e2731; border-radius: 6px; }

/* chat */
#chat { position: absolute; left: 8px; bottom: calc(84px + env(safe-area-inset-bottom)); width: min(330px, 70vw); padding: 5px; }
#chat .log { max-height: 116px; overflow-y: auto; font-size: 16px; line-height: 15px; padding: 2px; }
#chat .log div { margin: 1px 0; word-wrap: break-word; }
#chat .log b { color: #ffd84a; font-weight: normal; }
#chat .log .sys b { color: #b6f07a; }
#chat form { display: flex; gap: 4px; margin-top: 4px; }
#chat input { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 4px 6px; border: 2px solid #1d1216; border-radius: 5px; background: #fff7e8; color: #3e2731; }
#chat.min .log, #chat.min form { display: none; }
#chat.min { background: none; border-color: transparent; box-shadow: none; padding: 0; }
#chat .tgl { position: absolute; right: 4px; top: -24px; font-size: 14px; padding: 2px 6px; }

/* avvisi */
#toasts { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none !important; width: 92vw; }
.toast { padding: 6px 12px; font-size: 20px; text-align: center; animation: toast 3.4s ease forwards; max-width: 100%; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
#dead { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(40, 0, 0, .45); font-size: 30px; text-shadow: 2px 2px 0 #000; pointer-events: none !important; }

/* ---------- finestre ---------- */
.win-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(0,0,0,.45); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.win { position: relative; width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column; color: var(--sfl-text); }
.win > .sfl-outer { display: flex; flex-direction: column; min-height: 0; max-height: 92vh; }
.win-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; color: #fff; font-size: 28px; line-height: 24px; text-shadow: 2px 2px 0 #3e2731; }
.win-head img { width: 26px; height: 26px; image-rendering: pixelated; }
.win-head .x { margin-left: auto; width: 32px; height: 32px; background: url("/sfl/ui/close.png") center / contain no-repeat; border: 0; image-rendering: pixelated; }
.win-tabs { display: flex; gap: 4px; padding: 0 4px 6px; }
.win-tabs .tab { font-size: 18px; padding: 6px; }
.win-body { overflow-y: auto; min-height: 0; padding: 6px; }
.win-body.sfl-inner { color: var(--sfl-text); }
.cols { display: flex; gap: 10px; flex-wrap: wrap; }
.cols > * { flex: 1 1 260px; min-width: 0; }
h3 { margin: 4px 0 6px; font-size: 22px; font-weight: normal; color: #3e2731; }
.muted { color: #7a5545; font-size: 17px; }

/* caselle degli oggetti */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
.slot { position: relative; aspect-ratio: 1; background: #b96f50; border: 3px solid #7a4a35; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot img { width: 70%; height: 70%; object-fit: contain; image-rendering: pixelated; }
.slot .q { position: absolute; right: 2px; bottom: 0; font-family: "SflSecondary", monospace; font-size: 11px; color: #fff; text-shadow: 1px 1px 0 #000; }
.slot .pl { position: absolute; left: 2px; top: 0; font-family: "SflSecondary", monospace; font-size: 11px; color: #ffd84a; text-shadow: 1px 1px 0 #000; }
.slot.empty { opacity: .55; cursor: default; }
.slot.empty span { font-size: 12px; color: #fff; opacity: .8; text-align: center; line-height: 11px; }
.slot.sel { outline: 3px solid #fff; }
.r1 { border-color: #5fa83a; } .r2 { border-color: #3a8be0; } .r3 { border-color: #a35bea; box-shadow: 0 0 6px #c27aff; } .r4 { border-color: #f08a1c; box-shadow: 0 0 8px #ffa53a; }
.equip-grid { display: grid; grid-template-columns: repeat(3, 58px); gap: 6px; justify-content: center; }
.doll { display: flex; gap: 10px; align-items: center; justify-content: center; }
.doll canvas { width: 144px; height: 120px; image-rendering: pixelated; background: rgba(0,0,0,.1) url("/sfl/hud/profile_bg.png") center / cover; border: 3px solid #7a4a35; border-radius: 8px; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 18px; }
.stats b { font-weight: normal; color: #3e2731; text-align: right; }

/* dettaglio oggetto */
.detail { margin-top: 8px; padding: 8px; background: rgba(255,255,255,.25); border-radius: 6px; }
.detail .nm { font-size: 22px; text-shadow: 1px 1px 0 rgba(0,0,0,.4); }
.detail .rows { margin: 4px 0; font-size: 17px; }
.detail .acts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.detail input { width: 110px; font: inherit; font-size: 18px; padding: 4px; border: 2px solid #3e2731; border-radius: 5px; }

/* righe di elenco (negozio, mercato, boss, classifica) */
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px; background: rgba(255,255,255,.22); border-radius: 6px; }
.row .ic { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; background: #b96f50; border: 3px solid #7a4a35; border-radius: 6px; }
.row .ic img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; }
.row .tx { flex: 1; min-width: 0; font-size: 18px; }
.row .tx small { display: block; font-size: 15px; color: #6b4a3c; }
.price { display: flex; align-items: center; gap: 4px; font-size: 18px; white-space: nowrap; }
.price img { width: 18px; height: 18px; image-rendering: pixelated; }
.boss-card { display: flex; gap: 10px; padding: 8px; background: rgba(255,255,255,.22); border-radius: 8px; margin-bottom: 8px; }
.boss-card canvas { width: 96px; height: 96px; flex: none; image-rendering: pixelated; background: rgba(0,0,0,.12); border-radius: 8px; }
.boss-card .tx { flex: 1; min-width: 0; }
.boss-card .drops { display: flex; flex-wrap: wrap; gap: 3px; margin: 5px 0; }
.boss-card .drops .slot { width: 34px; height: 34px; border-width: 2px; }
.boss-end { text-align: center; }
.boss-end .slots { justify-content: center; grid-template-columns: repeat(auto-fill, 56px); }

#loading { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: #2b1d24; color: #fff; font-size: 24px; }
.spin { width: 36px; height: 36px; border: 4px solid #e4a672; border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  body.sfl-font { font-size: 20px; }
  #me { min-width: 0; width: 46vw; } #me .face { width: 38px; height: 38px; } #me .face canvas { left: -29px; top: -14px; }
  #target { top: calc(70px + env(safe-area-inset-top)); width: 60vw; }
  #bosshud { top: calc(118px + env(safe-area-inset-top)); }
  /* telefono: solo icone (i nomi restano nel suggerimento) */
  .act { width: 44px; height: 46px; gap: 0; } .act.hunt { width: 54px; } .act img { width: 28px; height: 28px; }
  #bar .act span { display: none; }
  /* sul telefono resta visibile solo il tempo della caccia automatica, piccolo sotto la spada */
  #bar .act.hunt span { display: block; font-size: 10px; line-height: 10px; }
  #bar { gap: 4px; padding: 4px; }
  #chat { bottom: calc(74px + env(safe-area-inset-bottom)); }
  #zoom { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
