:root {
	color-scheme: dark;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background: #0b0d12;
	color: #eef1f6;
	--nav-height: 58px;
	--accent: #4f7cff;
	--accent-bright: #78a0ff;
	--panel: rgba(18, 21, 29, 0.96);
	--border: #303746;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .3; filter: grayscale(.7); }

.tutorial-nav {
	position: fixed; z-index: 30; inset: 0 0 auto; height: var(--nav-height);
	display: flex; align-items: center; gap: 24px; padding: 0 18px;
	background: #10131a; border-bottom: 1px solid #2a303d; box-shadow: 0 4px 18px #0008;
}
.tutorial-brand { flex: none; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.tutorial-brand span { margin-left: 7px; padding: 3px 7px; border-radius: 999px; color: #bed0ff; background: #23365f; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.tutorial-nav nav { display: flex; align-self: stretch; gap: 4px; }
.tutorial-nav nav button { min-width: 88px; padding: 0 14px; color: #aeb6c5; background: transparent; border: 0; border-bottom: 2px solid transparent; }
.tutorial-nav nav button.active { color: #fff; border-bottom-color: var(--accent-bright); background: #1a1f2a; }
.tutorial-nav nav button.available:not(.active) { color: #dce5ff; animation: nav-pulse 1.3s infinite; }
.tutorial-balances { margin-left: auto; display: flex; gap: 14px; font-size: 12px; color: #9da7b8; }
.tutorial-balances span { padding: 7px 9px; border: 1px solid #2e3543; border-radius: 7px; background: #171b24; }
.tutorial-balances strong { color: #ffd369; }
.tutorial-language { flex: none; min-height: 32px; padding: 5px 7px; color: #dce3ef; background: #171b24; border: 1px solid #364052; border-radius: 7px; }

main { position: fixed; inset: var(--nav-height) 0 0; }
.tutorial-view { position: absolute; inset: 0; }
.tutorial-view[hidden] { display: none !important; }
.map-view { background: #0d1016; }
#map-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.map-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.event-marker { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; min-width: 56px; min-height: 56px; padding: 0; color: #fff; background: transparent; border: 0; }
.event-marker__pulse { position: absolute; inset: 3px; border: 2px solid #ffd45e; border-radius: 50%; animation: marker-pulse 1.35s infinite; }
.event-marker__icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; margin: auto; border: 2px solid #fff0ad; border-radius: 50%; color: #3b2b00; background: linear-gradient(#ffe68e, #e9aa2d); box-shadow: 0 3px 18px #ffc42c99; font-size: 23px; font-weight: 900; }
.event-marker__label { position: absolute; top: 55px; left: 50%; transform: translateX(-50%); width: max-content; padding: 5px 8px; border-radius: 6px; color: #fff; background: #111722ec; box-shadow: 0 2px 9px #000b; font-size: 12px; font-weight: 700; }
.battle-marker { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #ff8b75; border-radius: 8px; color: #fff; background: #481c1be8; box-shadow: 0 4px 20px #000a; font-size: 12px; }
.battle-marker__swords { font-size: 24px; animation: battle 600ms infinite alternate; }

.map-hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4; width: min(620px, calc(100vw - 32px)); padding: 10px 14px; border: 1px solid #80682a; border-radius: 8px; color: #ffe9a9; background: #332b16ee; text-align: center; font-size: 13px; box-shadow: 0 5px 20px #0008; }
.province-panel { position: absolute; z-index: 5; top: 18px; left: 18px; width: min(330px, calc(100vw - 36px)); padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 35px #000a; }
.province-panel__head { display: flex; gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid #2b303c; }
.province-panel__head div { display: grid; gap: 2px; }
.province-panel__head small { color: #9ba4b4; }
.province-swatch { width: 26px; height: 26px; border: 2px solid #ffffff66; border-radius: 6px; background: #747b89; }
.panel-block { padding-top: 12px; }
.panel-block h3 { margin: 0 0 10px; font-size: 14px; }
.empty-state { margin-bottom: 10px; padding: 9px; border: 1px dashed #39404f; border-radius: 7px; color: #9ea8b8; font-size: 12px; }
.business-card, .structure-card { display: grid; gap: 5px; margin-bottom: 10px; padding: 10px; border: 1px solid #3b465c; border-radius: 7px; background: #1a2130; font-size: 12px; }
.business-card span, .structure-card span { color: #aeb8c8; }
.business-card b { color: #ffd369; }
.panel-block button, .content-card button, .coach button, .complete-dialog button { width: 100%; min-height: 39px; padding: 9px 12px; border: 1px solid #6d91f6; border-radius: 7px; color: #fff; background: #355fc9; font-weight: 700; }
.panel-block button:hover:not(:disabled), .content-card button:hover:not(:disabled), .coach button:hover:not(:disabled), .complete-dialog button:hover:not(:disabled) { background: #4775e7; }

.content-view { overflow: auto; padding: 36px 20px 210px; background: radial-gradient(circle at 50% -20%, #1d2943, #0c0f15 55%); }
.content-card { width: min(760px, 100%); margin: 0 auto; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: #151922; box-shadow: 0 14px 42px #0008; }
.content-card h1 { margin: 0 0 6px; }
.content-card h2 { margin: 20px 0 12px; font-size: 18px; }
.content-card p { line-height: 1.5; }
.muted { color: #9ca5b5; }
.clan-row { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; margin-top: 22px; padding: 14px; border: 1px solid #35405a; border-radius: 9px; background: #1c2331; }
.clan-row div { display: grid; gap: 4px; }
.clan-row small { color: #99a4b6; }
.clan-row button { width: auto; min-width: 130px; }
.clan-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid #8bacff; border-radius: 50%; color: #e4ecff; background: #315cac; font-size: 12px; font-weight: 900; }
.clan-mark.large { width: 58px; height: 58px; font-size: 16px; }
.clan-title { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.clan-title h1, .clan-title p { margin: 0; }
.clan-title p { margin-top: 4px; color: #a9b2c1; }
.role-notice { display: grid; gap: 7px; margin: 18px 0; padding: 14px; border: 1px solid #5574bd; border-radius: 9px; background: #1b2947; }
.role-notice span { color: #c4d3f5; line-height: 1.45; }
.army-summary { display: flex; justify-content: space-between; align-items: center; padding: 14px; border: 1px solid #343d4f; border-radius: 8px; background: #1b202b; }
.army-summary strong { color: #fff; font-size: 24px; }
#start-invasion { margin-top: 10px; border-color: #d56e5c; background: #a43e31; }
#start-invasion:hover:not(:disabled) { background: #c04c3e; }

.coach { position: fixed; z-index: 40; right: 18px; bottom: 18px; width: min(440px, calc(100vw - 36px)); padding: 16px 18px; border: 1px solid #5879c8; border-radius: 12px; background: #141b2af5; box-shadow: 0 12px 42px #000c, 0 0 0 1px #ffffff08 inset; }
.coach__eyebrow { display: flex; justify-content: space-between; color: #89a8f6; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.coach h2 { margin: 9px 0 6px; font-size: 18px; }
.coach p { margin: 0; color: #c2c9d5; font-size: 13px; line-height: 1.5; }
.coach button { margin-top: 13px; }
.toast { position: fixed; z-index: 60; left: 50%; top: calc(var(--nav-height) + 15px); transform: translateX(-50%); max-width: min(520px, calc(100vw - 24px)); padding: 10px 14px; border: 1px solid #b5913e; border-radius: 8px; color: #ffecad; background: #3b3018f5; box-shadow: 0 7px 24px #000b; text-align: center; font-size: 13px; }
.loading { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: #0b0e14; }
.loading[hidden] { display: none; }
.loading span { width: 42px; height: 42px; border: 4px solid #28324a; border-top-color: #6e95ff; border-radius: 50%; animation: spin .8s linear infinite; }
.loading strong { color: #b9c4da; }

.complete-dialog { width: min(500px, calc(100vw - 30px)); padding: 25px; border: 1px solid #5475c5; border-radius: 14px; color: #eef2fb; background: #151b28; box-shadow: 0 20px 70px #000d; text-align: center; }
.complete-dialog::backdrop { background: #05070bd9; backdrop-filter: blur(3px); }
.complete-dialog h2 { margin: 9px 0; }
.complete-dialog p { color: #bac3d2; line-height: 1.5; }
.complete-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: auto; border-radius: 50%; color: #0e2818; background: #6ee79a; font-size: 32px; font-weight: 900; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes marker-pulse { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes battle { to { transform: rotate(8deg) scale(1.12); } }
@keyframes nav-pulse { 50% { background: #26395f; } }

@media (max-width: 720px) {
	:root { --nav-height: 96px; }
	.tutorial-nav { height: var(--nav-height); flex-wrap: wrap; align-content: center; gap: 5px 12px; padding: 8px 10px; }
	.tutorial-brand { font-size: 15px; }
	.tutorial-nav nav { order: 3; width: 100%; height: 38px; }
	.tutorial-nav nav button { flex: 1; min-width: 0; padding: 0 6px; font-size: 12px; }
	.tutorial-balances { font-size: 10px; gap: 5px; }
	.tutorial-balances span { padding: 5px 6px; }
	.tutorial-language { min-height: 29px; max-width: 78px; font-size: 11px; }
	.province-panel { top: 9px; left: 9px; width: calc(100vw - 18px); max-height: calc(100vh - var(--nav-height) - 205px); overflow: auto; }
	.coach { right: 9px; bottom: 9px; width: calc(100vw - 18px); padding: 13px 14px; }
	.coach h2 { font-size: 15px; }
	.coach p { font-size: 12px; }
	.content-view { padding: 18px 10px 220px; }
	.content-card { padding: 17px; }
	.clan-row { grid-template-columns: auto 1fr; }
	.clan-row button { grid-column: 1 / -1; width: 100%; }
}
