@font-face { font-family: 'Lilita'; src: url('lilita-one.woff2') format('woff2'); }
* { box-sizing: border-box; user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1e5f8e; font-family: 'Lilita', 'Trebuchet MS', sans-serif; color: #3a2412; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.hidden { display: none !important; }
.ol { color: #fff; text-shadow: -1.5px -1.5px 0 #2b1a10, 1.5px -1.5px 0 #2b1a10, -1.5px 1.5px 0 #2b1a10, 1.5px 1.5px 0 #2b1a10, 0 3px 0 #2b1a10; }

.card { background: linear-gradient(#fbf0d6, #efdcb3); border: 4px solid #2b1a10; border-radius: 18px; box-shadow: inset 0 0 0 3px #fff6e0, 0 6px 0 rgba(0,0,0,.35); }
.pill { background: rgba(43,26,16,.82); color: #fff; border: 3px solid #2b1a10; border-radius: 14px; padding: 5px 12px; display: flex; align-items: center; gap: 7px; font-size: 16px; }
.pill img { width: 24px; height: 24px; }

.btn { font: inherit; font-size: 18px; color: #fff; cursor: pointer; border: 3px solid #2b1a10; border-radius: 13px; padding: 8px 15px; background: linear-gradient(#5aa8ea 50%, #3f8cd2 50%); box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #2b1a10; text-shadow: -1px -1px 0 #2b1a10, 1px -1px 0 #2b1a10, -1px 1px 0 #2b1a10, 1px 1px 0 #2b1a10; transition: transform .05s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 1px 0 #2b1a10; }
.btn:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn.green { background: linear-gradient(#7ed04a 50%, #5fb534 50%); }
.btn.red { background: linear-gradient(#ee6a4a 50%, #d84a2e 50%); }
.btn.gold { background: linear-gradient(#f7cc4a 50%, #e8ad2c 50%); }
.btn.big { font-size: 26px; padding: 11px 24px; }
.btn.small { font-size: 14px; padding: 4px 10px; }
.btn[disabled] { filter: grayscale(.9) brightness(.85); cursor: not-allowed; }
.btn img { width: 18px; height: 18px; }

#hud { position: fixed; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; pointer-events: none; }
#resbar { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: center; }
#resbar .pill { min-width: 104px; }
#who { font-size: 17px; }
#season { flex-direction: column; align-items: flex-end; gap: 0; font-size: 16px; padding: 4px 12px; }
#season small { font-size: 12px; opacity: .85; font-family: 'Trebuchet MS', sans-serif; }

#side { position: fixed; right: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 9px; align-items: stretch; }

#panel { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 11px 15px; min-width: 330px; max-width: min(760px, calc(100vw - 210px)); }
#panel h3 { margin: 0; font-size: 21px; font-weight: normal; }
#panel p { margin: 2px 0 8px; font: 13px 'Trebuchet MS', sans-serif; }
.row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.chips { display: inline-flex; gap: 7px; align-items: center; font-size: 15px; flex-wrap: wrap; }
.chips img { width: 18px; height: 18px; vertical-align: -3px; margin-right: 1px; }
.short { color: #d22; }
.btn .short { color: #ffb4a2; }

#placing { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 9px 15px; display: flex; gap: 12px; align-items: center; font-size: 17px; }

#battleTop { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; pointer-events: none; flex-wrap: wrap; justify-content: center; width: calc(100vw - 20px); }
#battleTop .stars { color: #666; font-size: 26px; letter-spacing: 2px; }
#battleTop .stars b { color: #ffd23f; font-weight: normal; }
#battleBar { position: fixed; bottom: 12px; left: 12px; right: 170px; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.troop { width: 82px; height: 96px; position: relative; padding: 2px; cursor: pointer; background: linear-gradient(#fbf0d6, #e4cc9a); border: 3px solid #2b1a10; border-radius: 12px; font: inherit; color: #3a2412; box-shadow: 0 4px 0 #2b1a10; }
.troop:focus-visible { outline: 3px solid #fff; }
.troop.sel { border-color: #fff; box-shadow: 0 0 0 3px #2b1a10, 0 4px 0 3px #2b1a10; transform: translateY(-5px); }
.troop.none { filter: grayscale(1) brightness(.7); }
.troop img { width: 72px; height: 72px; pointer-events: none; }
.troop .n { position: absolute; top: 2px; left: 6px; font-size: 19px; color: #fff; text-shadow: -1px -1px 0 #2b1a10, 1px -1px 0 #2b1a10, -1px 1px 0 #2b1a10, 1px 1px 0 #2b1a10; }
.troop .nm { position: absolute; bottom: 2px; left: 0; right: 0; font-size: 11px; text-align: center; }
#battleBtns { position: fixed; right: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 9px; }

#toast { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); background: #c8322b; color: #fff; border: 3px solid #2b1a10; border-radius: 12px; padding: 7px 16px; font-size: 18px; z-index: 30; pointer-events: none; }

#modalWrap { position: fixed; inset: 0; background: rgba(20,12,6,.55); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
#modal { width: min(860px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; padding: 13px 16px; }
#modalHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
#modalHead h2 { margin: 0; font-size: 28px; font-weight: normal; }
#modalBody { overflow-y: auto; padding: 3px 5px 8px 2px; }
#modalBody h4 { font-weight: normal; font-size: 20px; margin: 11px 0 6px; }
#modalBody p { font: 14px 'Trebuchet MS', sans-serif; margin: 4px 0 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.item { background: #fff8e6; border: 3px solid #2b1a10; border-radius: 12px; padding: 7px 9px; display: flex; flex-direction: column; gap: 4px; }
.item.locked { opacity: .6; }
.item h5 { margin: 0; font-size: 17px; font-weight: normal; }
.item .d { font: 12px 'Trebuchet MS', sans-serif; min-height: 28px; }
.item .pic { height: 84px; display: flex; justify-content: center; align-items: center; background: #cfe5a8; border-radius: 8px; overflow: hidden; }
.item .pic img { max-height: 84px; max-width: 100%; }
.item .pic.dark { background: #2d5c47; }
table { border-collapse: collapse; width: 100%; font: 15px 'Trebuchet MS', sans-serif; }
td, th { border-bottom: 2px solid #d6c08f; padding: 5px 7px; text-align: left; }

#chatLog { height: 46vh; overflow-y: auto; margin: 8px 0; padding: 7px 10px; background: #fff8e6; border: 3px solid #2b1a10; border-radius: 12px; font: 15px 'Trebuchet MS', sans-serif; overflow-wrap: anywhere; }
#chatLog > div { padding: 2px 0; }
#chatLog time { font-size: 11px; opacity: .6; margin-right: 6px; }
#chatLog b.viking { color: #2a6da8; }
#chatLog b.english { color: #b5341f; }
#chatLog .sys { font-style: italic; opacity: .7; }
#chatLog .who { font: inherit; font-weight: bold; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
#chatLog .who.viking { color: #2a6da8; }
#chatLog .who.english { color: #b5341f; }
#chatLog .acts { margin-left: 8px; display: inline-flex; gap: 5px; vertical-align: middle; }
#chatBlocked { margin-top: 8px; font: 13px 'Trebuchet MS', sans-serif; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#chatSend { display: flex; gap: 7px; }
#chatSend input { flex: 1; min-width: 0; }
#clanForm { display: flex; gap: 7px; flex-wrap: wrap; align-items: flex-end; }
#clanForm label { flex: 1; min-width: 170px; }

#quest { position: fixed; top: 60px; left: 10px; width: 280px; padding: 9px 12px; z-index: 5; }
#quest h4 { margin: 0 0 3px; font-size: 16px; font-weight: normal; color: #a4641a; }
#quest p { margin: 0 0 7px; font: 14px/1.35 'Trebuchet MS', sans-serif; }
@keyframes tutGlow { 0%, 100% { box-shadow: 0 0 0 3px #ffd23f, 0 0 8px 3px #ffd23f; } 50% { box-shadow: 0 0 0 6px #ffd23f, 0 0 24px 10px #ffd23f; } }
.tutglow { animation: tutGlow 1s ease-in-out infinite; }
#sideSmall { flex-wrap: nowrap; }
#sideSmall .btn { flex: 1; padding: 4px 7px; font-size: 13px; white-space: nowrap; }
input[type=range] { width: 100%; padding: 0; border: 0; background: none; accent-color: #5fb534; cursor: pointer; }

@keyframes popIn { 0% { transform: scale(.82); opacity: 0; } 65% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
@keyframes toastIn { 0% { transform: translateX(-50%) scale(.7); } 60% { transform: translateX(-50%) scale(1.08); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes panelIn { 0% { transform: translateX(-50%) translateY(26px); opacity: 0; } 100% { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 60% { transform: scale(1.35) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes bigStar { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-30deg); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.2) rotate(6deg); opacity: 1; } 65% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -160%) scale(.5); opacity: 0; } }
#modal { animation: popIn .18s ease-out; }
#toast { animation: toastIn .18s ease-out; }
#panel { animation: panelIn .14s ease-out; }
.pill.bump { animation: bump .16s ease-out; }
.bigstar { position: fixed; top: 38%; left: 50%; font-size: 150px; line-height: 1; color: #ffd23f; pointer-events: none; z-index: 15; text-shadow: -4px -4px 0 #2b1a10, 4px -4px 0 #2b1a10, -4px 4px 0 #2b1a10, 4px 4px 0 #2b1a10, 0 9px 0 #2b1a10; animation: bigStar 1s ease-in-out forwards; }
.rstars { display: flex; justify-content: center; gap: 8px; font-size: 76px; line-height: 1.1; margin: 4px 0; }
.rstars span { color: #b7a98a; text-shadow: -3px -3px 0 #2b1a10, 3px -3px 0 #2b1a10, -3px 3px 0 #2b1a10, 3px 3px 0 #2b1a10, 0 5px 0 #2b1a10; }
.rstars span.won { color: #ffd23f; opacity: 0; animation: starPop .4s ease-out forwards; }
.rstars span:nth-child(2) { font-size: 96px; margin-top: -8px; }
.rpct { text-align: center; font-size: 24px; }
@media (prefers-reduced-motion: reduce) { #modal, #toast, #panel, .pill.bump { animation: none; } }

#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 40; background: rgba(15,40,60,.35); padding: 16px; overflow: auto; }
#loginCard { width: 520px; max-width: 100%; padding: 16px 22px 18px; display: flex; flex-direction: column; gap: 8px; }
#loginCard h1 { margin: 0; text-align: center; font-size: 44px; font-weight: normal; color: #f7cc4a; text-shadow: -2px -2px 0 #2b1a10, 2px -2px 0 #2b1a10, -2px 2px 0 #2b1a10, 2px 2px 0 #2b1a10, 0 5px 0 #2b1a10; }
#loginCard h1 span { color: #fff; }
.sub { margin: 0; text-align: center; font: 14px 'Trebuchet MS', sans-serif; }
#tabs { display: flex; gap: 8px; justify-content: center; }
#factions { display: flex; gap: 10px; }
.faction { flex: 1; cursor: pointer; background: #fff8e6; border: 3px solid #2b1a10; border-radius: 13px; font: inherit; color: inherit; padding: 5px 8px 8px; }
.faction img { width: 96px; height: 96px; display: block; margin: auto; }
.faction b { font-weight: normal; font-size: 21px; display: block; }
.faction small { font: 12px 'Trebuchet MS', sans-serif; }
.faction.sel { background: #ffe58a; box-shadow: 0 0 0 3px #e8ad2c; }
label { display: flex; flex-direction: column; font-size: 15px; gap: 2px; }
input { font: 16px 'Trebuchet MS', sans-serif; padding: 7px 10px; border: 3px solid #2b1a10; border-radius: 10px; background: #fff; user-select: text; }
#loginErr { color: #c8322b; min-height: 20px; text-align: center; font-size: 16px; }
