* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8ec5e8; color: #f6ead0;
  font-family: Georgia, "Times New Roman", serif; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; touch-action: none; }
#game canvas { display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; }
.hidden { display: none !important; }

.big { background: linear-gradient(#8a5a30, #5a3518); border: 2px solid #e0b860; border-radius: 12px;
  padding: 10px 18px; font-size: 18px; font-weight: bold; box-shadow: 0 3px 0 #2a1808, 0 0 10px #00000060; color: #fff4d8; }
.big.go { background: linear-gradient(#4a8a3a, #2a5a20); border-color: #c8f088; }
button:disabled { filter: grayscale(.85) brightness(.6); cursor: default; }
button:not(:disabled):active { transform: translateY(2px); }

/* ------------------------------------------------ player docks */
.panelBg { background: linear-gradient(#3a2814f2, #24180cf2); border: 2px solid var(--pc); border-radius: 14px;
  box-shadow: 0 0 0 2px #1a0f06, 0 6px 16px #00000080; }
.dock { position: fixed; z-index: 5; width: min(580px, 97vw); padding: 7px 9px; }
.dock.bottom { bottom: 6px; left: 50%; transform: translateX(-50%); }
.dock.left { bottom: 6px; left: 1vw; width: 48.5vw; }
.dock.right { bottom: 6px; right: 1vw; width: 48.5vw; }
.dock.flip { top: 6px; left: 50%; transform: translateX(-50%) rotate(180deg); }
.dRow { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.dName { font-weight: bold; color: var(--pc); text-shadow: 0 1px 0 #000; }
.hpBar { flex: 1; height: 14px; background: #1a0f06; border-radius: 7px; overflow: hidden; position: relative; border: 1px solid #e0b86060; }
.hpBar .fill { position: absolute; inset: 0; width: 100%; background: linear-gradient(90deg, #c83a2a, #e8a040); transition: width .2s; }
.hpBar span { position: relative; font-size: 11px; font-weight: bold; padding-left: 6px; line-height: 14px; text-shadow: 0 0 3px #000; }
.dStats { margin: 5px 0 4px; gap: 12px; }
.dStats b.ae { color: #ffd84a; }
.dTimer { margin-left: auto; color: #ffd27a; }
.camp { font-size: 13px; margin-bottom: 5px; background: #00000040; border: 1px dashed #c8a05080; border-radius: 8px; padding: 3px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp b { color: #ff9a6a; }
.dBtns { display: flex; gap: 6px; }
.dBtns button { flex: 1; background: linear-gradient(#6a4422, #4a2c12); border: 1px solid #c8a050; border-radius: 9px; padding: 6px 2px;
  font-size: 14px; font-weight: bold; line-height: 1.2; box-shadow: 0 2px 0 #1a0f06; }
.dBtns button small { display: block; font-weight: normal; font-size: 11px; opacity: .85; }
.dBtns .bReady { background: linear-gradient(#3a7a2a, #22501a); border-color: #b8e878; }
.dBtns .bReady.on { background: #b8e878; color: #1a3010; }
.dBtns .bSmall { flex: 0 0 40px; }
.dBtns button.active { outline: 2px solid #ffe8a0; }
.dHint { font-size: 12px; color: #f0dcb0; min-height: 15px; margin-top: 4px; text-align: center; white-space: normal; }
.dHint.evolve { color: #ffd84a; font-weight: bold; }

.popup { position: absolute; left: -2px; right: -2px; bottom: calc(100% + 6px); padding: 10px; max-height: 64vh; overflow-y: auto; }
.popup .close { position: absolute; right: 8px; top: 4px; background: none; font-size: 18px; opacity: .8; }
.popup h3 { margin: 0 0 8px; font-size: 16px; color: #ffe0a0; }
.units { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.unit { position: relative; background: #2a1a0c; border: 2px solid #8a6a3a; border-radius: 10px; padding: 6px 5px; text-align: center; }
.unit .ico { font-size: 30px; line-height: 1.1; }
.unit .nm { font-weight: bold; font-size: 13px; line-height: 1.15; }
.unit .kind { font-size: 11px; opacity: .8; margin-bottom: 2px; }
.unit button { width: 100%; margin-top: 4px; background: linear-gradient(#4a8a3a, #2a5a20); border: 1px solid #c8f088; border-radius: 8px; padding: 5px 2px; font-weight: bold; font-size: 13px; }
.unit .pair { position: absolute; top: 3px; right: 4px; font-size: 10px; color: #ffd84a; }
.bars { font-size: 11px; line-height: 1.35; text-align: left; display: inline-block; }
.bars i { font-style: normal; letter-spacing: 1px; color: #ffcf5a; }
.bars i.dim { color: #6a5030; }
.popRow { display: flex; gap: 6px; margin-top: 8px; }
.popRow button { flex: 1; background: linear-gradient(#6a4422, #4a2c12); border: 1px solid #c8a050; border-radius: 9px; padding: 7px; font-weight: bold; font-size: 13px; }
.sends { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.sends button { background: linear-gradient(#7a2a1a, #4a160c); border: 1px solid #ff9a6a; border-radius: 9px; padding: 6px 4px; font-size: 13px; line-height: 1.3; }
.sends small { display: block; font-size: 11px; opacity: .85; }
.note { font-size: 12px; opacity: .85; margin-top: 6px; }
.bp .nm { font-size: 18px; font-weight: bold; }
.bp .rar { font-size: 12px; font-weight: bold; letter-spacing: 2px; }
.bp .desc { font-size: 12px; opacity: .85; margin: 3px 0; }
.bp .hpLine { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 5px 0; }
.bp .hpLine .hpBar { height: 10px; }
.bp .hpLine .hpBar .fill { background: linear-gradient(90deg, #3aa83a, #9ae86a); }
.bp .popRow .evo { background: linear-gradient(#b07a10, #6a4208); border-color: #ffd84a; }
.bp .popRow .sell { background: linear-gradient(#7a3a1a, #4a200c); border-color: #ff9d6b; }
.bp .popRow .up { background: linear-gradient(#2a5a8a, #183a5a); border-color: #8ac8ff; }

#rival { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 4; width: min(440px, 94vw);
  padding: 5px 10px; font-size: 13px; pointer-events: none; --pc: #e84a3a; }

#waveBanner { position: fixed; top: 32%; left: 0; right: 0; text-align: center; font-size: 40px; font-weight: bold; z-index: 6;
  letter-spacing: 3px; color: #ffe8a0; text-shadow: 0 3px 0 #5a2a0a, 0 0 18px #000; opacity: 0; pointer-events: none; transition: opacity .4s; padding: 0 10px; }
#waveBanner.show { opacity: 1; }
#waveBanner small { display: block; font-size: 19px; letter-spacing: 1px; color: #ffb08a; }

#reveal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 7; }
#reveal .card { position: relative; width: 250px; padding: 18px; text-align: center; border-radius: 16px;
  background: linear-gradient(#3a2814f4, #24180cf4); border: 3px solid var(--rc, #fff); box-shadow: 0 0 36px var(--rc, #fff);
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); overflow: hidden; }
#reveal .rays { position: absolute; inset: -60%; background: repeating-conic-gradient(var(--rc) 0 8deg, transparent 8deg 24deg);
  opacity: .16; animation: spin 6s linear infinite; }
#reveal .card > div:not(.rays) { position: relative; }
#rIcon { font-size: 60px; animation: shake .5s ease-in-out 2; }
#rRarity { font-weight: bold; letter-spacing: 3px; color: var(--rc); }
#rName { font-size: 22px; font-weight: bold; margin: 4px 0; }
#rTip { font-size: 22px; font-weight: bold; color: #ffd84a; margin-top: 6px; font-style: italic; }
@keyframes pop { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 25% { transform: rotate(-12deg) scale(1.15); } 75% { transform: rotate(12deg) scale(1.15); } }

.screen { position: fixed; inset: 0; z-index: 10; background: radial-gradient(circle at 50% 35%, #3a5a2ae8, #1a2410f8);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; overflow-y: auto; }
.screen h1 { font-size: 56px; margin: 0; letter-spacing: 8px; color: #ffd84a; text-shadow: 0 4px 0 #6a3a0a, 0 0 24px #000; }
.screen h2 { margin: 0 0 10px; color: #f0e0b0; letter-spacing: 5px; text-shadow: 0 2px 0 #3a2008; }
.screen p { max-width: 520px; line-height: 1.45; margin: 6px 0; }
.screen ul { text-align: left; max-width: 500px; line-height: 1.7; padding-left: 10px; list-style: none; margin: 6px 0; }
.screen > .big { margin-top: 12px; min-width: 200px; }
.modes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.modeBox { background: #2a1a0cd0; border: 2px solid #c8a050; border-radius: 14px; padding: 10px 12px; }
.modeTitle { font-weight: bold; margin-bottom: 8px; }
.diffs { display: flex; gap: 6px; }
.diffs .big { padding: 8px 12px; font-size: 16px; }

#classList { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1100px; }
.classCard { width: 200px; background: linear-gradient(#3a2814, #24180c); border: 3px solid var(--cc); border-radius: 14px; padding: 10px;
  text-align: left; box-shadow: 0 0 14px #00000080; }
.classCard:hover { transform: translateY(-3px); box-shadow: 0 0 20px var(--cc); }
.classCard .cIco { font-size: 36px; text-align: center; }
.classCard .cName { font-size: 18px; font-weight: bold; text-align: center; color: var(--cc); }
.classCard .cDesc { font-size: 12px; text-align: center; opacity: .85; margin-bottom: 6px; }
.classCard .cUnit { font-size: 12px; display: flex; justify-content: space-between; gap: 4px; line-height: 1.5; }
.classCard .cUnit span:first-child { flex: 1; min-width: 0; }
.classCard .cUnit span:last-child { color: #ffd84a; white-space: nowrap; }

@media (max-width: 640px), (max-height: 520px) {
  .screen h1 { font-size: 36px; letter-spacing: 4px; }
  .screen ul { font-size: 14px; line-height: 1.5; }
  .screen p { font-size: 14px; }
  .dRow { font-size: 12px; gap: 6px; }
  .dStats { gap: 8px; }
  .dBtns button { font-size: 12px; padding: 5px 1px; }
  .unit .ico { font-size: 24px; }
  .unit .nm { font-size: 12px; }
  #waveBanner { font-size: 26px; }
  .bp .desc { display: none; }
  .classCard { width: 46%; padding: 7px; }
  .classCard .cUnit { font-size: 11px; }
  .classCard .cIco { font-size: 28px; }
}
