/* ===== POTATO VALLEY — feuille de style ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #0b1d3a; overflow: hidden;
  font-family: 'Courier New', Consolas, monospace; color: #3b2410; user-select: none; }
.hidden { display: none !important; }
#stage { position: fixed; inset: 0; }
#app { position: absolute; left: 0; top: 0; width: 960px; height: 640px;
  transform-origin: 0 0; overflow: hidden; background: #000; }
canvas { display: block; position: absolute; left: 0; top: 0; image-rendering: pixelated; }
button { font-family: inherit; cursor: pointer; }
.small { font-size: 11px; opacity: .85; }

/* ----- Panneaux façon parchemin ----- */
.panel { background: #f6dfaa; border: 4px solid #8a4a1c; border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fff0c8, 0 3px 0 #4a2a10; padding: 6px 10px; }

/* ----- MENU ----- */
#menu { position: absolute; inset: 0; }
#logo { position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 470px; padding: 12px 10px 4px; text-align: center;
  background: repeating-linear-gradient(180deg, #ecbc72 0 30px, #c98f48 30px 32px);
  border: 6px solid #7a4318; border-radius: 12px;
  box-shadow: inset 0 0 0 3px #e0a050, 0 6px 0 #4a2a10, 0 14px 24px rgba(0,0,0,.35); }
.lt { font-family: Impact, 'Arial Black', sans-serif; font-size: 64px; line-height: 66px;
  letter-spacing: 5px; color: #e2682a;
  text-shadow: 3px 0 #7a2a0e, -3px 0 #7a2a0e, 0 3px #7a2a0e, 0 -3px #7a2a0e,
    3px 3px #7a2a0e, -3px -3px #7a2a0e, 3px -3px #7a2a0e, -3px 3px #7a2a0e, 0 6px 0 #4a1a08; }
.leaf { position: absolute; font-size: 30px; }
.l1 { left: -14px; top: -14px; transform: rotate(-30deg); }
.l2 { right: -10px; top: -16px; transform: rotate(40deg); }
.l3 { right: 70px; bottom: -6px; transform: rotate(120deg); }
#menuInfo { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px;
  color: #fff; font-weight: bold; text-shadow: 2px 2px 0 #1a3a6a; font-size: 15px; text-align: center; min-height: 20px; }
#menuButtons { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; }
.mbtn { width: 98px; height: 76px; background: linear-gradient(#f6d79a, #d9a35a);
  border: 4px solid #8a4a1c; border-radius: 4px;
  box-shadow: inset 0 0 0 2px #f9e6b8, 0 4px 0 #4a2a10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; transition: transform .08s; }
.mbtn span { font-size: 15px; font-weight: bold; color: #e24a5a;
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; }
.mbtn i { font-style: normal; font-size: 20px; }
.mbtn:hover { transform: translateY(-4px); background: linear-gradient(#fff0c8, #f0c27a); }
.mbtn:active { transform: translateY(1px); }
#credit { position: absolute; bottom: 8px; width: 100%; text-align: center; font-size: 11px;
  color: #0b4a6a; opacity: .8; }

/* ----- HUD ----- */
/* panneaux du haut légèrement translucides pour laisser voir le décor */
#gameLayer .panel { background: rgba(246,223,170,.72); }
#hudDate { position: absolute; left: 8px; top: 8px; min-width: 150px; line-height: 1.35; }
#dDay { font-weight: bold; font-size: 15px; }
#dClock { font-size: 20px; font-weight: bold; color: #7a2a0e; }
/* panneau argent : centré en haut de l'écran */
#hudGold { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 230px; text-align: center; }
/* panneau des statistiques : remonté en haut à droite */
#hudRight { position: absolute; right: 8px; top: 8px; width: 210px; display: flex; flex-direction: column; gap: 6px; }
.goldline { font-size: 20px; text-align: center; }
.bar { flex: 1; height: 12px; background: #5a3a1d; border: 2px solid #3b2410; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0%; transition: width .2s; }
.barrow { display: flex; align-items: center; gap: 4px; margin: 3px 0; font-size: 12px; }
.barrow span { width: 18px; }
.barrow em { font-style: normal; width: 64px; text-align: right; font-size: 11px; }
#toasts { position: absolute; left: 50%; transform: translateX(-50%); bottom: 170px; width: 560px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { background: rgba(40,22,8,.88); color: #fff3d0; padding: 5px 12px; border-radius: 4px;
  border: 2px solid #c98f48; font-size: 13px; animation: tin .2s; text-align: center; }
.toast.good { border-color: #6cc04a; } .toast.bad { border-color: #e0584a; } .toast.gold { border-color: #e6b422; color: #ffe27a; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#selName { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%);
  color: #fff; font-weight: bold; font-size: 13px; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
/* la barre d'objets passe sur 2 lignes quand il y a beaucoup d'outils / armes */
#hotbar { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px;
  flex-wrap: wrap; justify-content: center; max-width: 700px;
  padding: 4px; background: #c98f48; border: 4px solid #7a4318; border-radius: 6px; box-shadow: 0 3px 0 #4a2a10; }
.slot { position: relative; width: 44px; height: 44px; background: #f0d9a0; border: 3px solid #a06a30;
  border-radius: 3px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
/* barre de munitions / rechargement sous l'icône d'une arme */
.slot .wbar { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 5px; background: #3b2410; border-radius: 2px; overflow: hidden; }
.slot .wbar > i { display: block; height: 100%; width: 100%; background: #ffd84a; }
/* bandeau de raid */
#raidBox { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); white-space: nowrap; font-size: 13px;
  background: rgba(120,20,20,.85) !important; border-color: #ff6b5a; color: #fff; text-shadow: 1px 1px 0 #000; animation: raidpulse 1s infinite alternate; }
@keyframes raidpulse { from { box-shadow: inset 0 0 0 2px #ffb0a8, 0 0 0 rgba(255,60,40,0); } to { box-shadow: inset 0 0 0 2px #ffb0a8, 0 0 14px rgba(255,60,40,.9); } }
.slot.sel { border-color: #e22; background: #fff3c4; box-shadow: 0 0 0 2px #fff inset; }
.slot .key { position: absolute; left: 2px; top: 0; font-size: 10px; font-weight: bold; color: #7a4318; }
.slot .cnt { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: bold; color: #222;
  text-shadow: 1px 1px 0 #fff; }
.ico { width: 32px; height: 32px; image-rendering: pixelated; position: static; flex: none; }
#hint { position: absolute; left: 8px; bottom: 4px; font-size: 10px; color: #fff; opacity: .75;
  text-shadow: 1px 1px 0 #000; max-width: 220px; line-height: 1.2; }

/* ----- Fenêtres ----- */
#modal { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
#modalBox { width: 740px; max-height: 600px; overflow-y: auto; padding: 14px 18px; font-size: 14px; }
#modalBox h2 { font-size: 22px; color: #7a2a0e; margin-bottom: 6px; }
#modalBox h3 { font-size: 15px; margin: 8px 0 4px; color: #7a4318; }
#modalBox p { margin: 4px 0; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 2px dotted #c9a25a; }
.row .info { flex: 1; } .row .price { width: 80px; text-align: right; font-weight: bold; }
.btn { background: linear-gradient(#8ed06a, #4fa83d); border: 3px solid #2d6a22; color: #fff; font-weight: bold;
  padding: 4px 10px; border-radius: 4px; text-shadow: 1px 1px 0 #1d4a14; font-size: 13px; }
.btn:hover { filter: brightness(1.12); } .btn:disabled { filter: grayscale(1) brightness(.9); cursor: not-allowed; }
.btn.red { background: linear-gradient(#f08a7a, #c0392b); border-color: #7a1f14; text-shadow: 1px 1px 0 #5a140c; }
.btn.blue { background: linear-gradient(#7ab8f0, #2f7fc9); border-color: #1d4a7a; text-shadow: 1px 1px 0 #123a62; }
.btn.tab { background: #d9b070; border-color: #8a4a1c; color: #5a2a0c; text-shadow: none; }
.btn.tab.on { background: #fff0c8; }
.tabs { display: flex; gap: 6px; margin: 6px 0 8px; flex-wrap: wrap; }
.footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.goldhead { float: right; font-size: 18px; font-weight: bold; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cell { background: #fff0c8; border: 2px solid #a06a30; border-radius: 4px; padding: 6px; text-align: center; font-size: 12px; }
.cell .ico { margin: 0 auto 2px; display: block; }
.qrow { padding: 6px; border: 2px solid #c9a25a; border-radius: 4px; margin: 5px 0; background: #fff0c8; }
.qrow.done { opacity: .6; text-decoration: line-through; }
.qrow .bar { margin-top: 4px; }
.pmenu { display: flex; flex-direction: column; gap: 8px; width: 280px; margin: 10px auto; }
.pmenu .btn { padding: 8px; font-size: 15px; }
kbd { background: #fff0c8; border: 2px solid #a06a30; border-radius: 3px; padding: 0 4px; font-size: 12px; }
table.rec { width: 100%; border-collapse: collapse; } table.rec td { padding: 6px; border-bottom: 2px dotted #c9a25a; }
.up { color: #1d8a2a; } .down { color: #c0392b; }

/* ----- Fondu ----- */
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s; z-index: 80; }
#fade.on { opacity: 1; pointer-events: all; }
