:root {
	--bg: #0b0f0d;
	--turf1: #1e6b3a;
	--turf2: #237d43;
	--line: #eafff0d9;
	--red: #e8543f;
	--red-dark: #b53d2c;
	--blue: #3f7fe8;
	--blue-dark: #2c5bb5;
	--panel: #121814cc;
	--gold: #e8c667;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(circle at 50% 20%, #182420, var(--bg) 70%); color: #eef2ee; font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
#app { position: relative; display: flex; width: 100%; height: 100%; max-width: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; }
#helpBtn { position: fixed; top: 12px; left: 12px; z-index: 50; width: 38px; height: 38px; border: 1px solid #ffffff2e; border-radius: 50%; background: var(--panel); color: var(--gold); font-size: 17px; font-weight: 700; cursor: pointer; }
#helpModal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: #000000a8; }
#helpCard { width: min(420px, 88%); padding: 24px 26px; border: 1px solid #ffffff22; border-radius: 16px; background: #141d17; box-shadow: 0 20px 50px #000a; }
#helpCard h2 { margin: 0 0 12px; color: var(--gold); font-size: 18px; }
#helpCard ul { margin: 0; padding-inline-start: 20px; color: #dbe6df; font-size: 14px; line-height: 2; }
#helpCard button, #restart { margin-top: 16px; width: 100%; padding: 10px; border: 1px solid #ffffff22; border-radius: 10px; background: linear-gradient(160deg, #2c4635, #1c2b22); color: #eef2ee; cursor: pointer; }
#start { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 36px 46px; border: 1px solid #ffffff14; border-radius: 18px; background: var(--panel); backdrop-filter: blur(6px); }
#start h1 { margin: 0; color: var(--gold); font-size: clamp(22px, 4vw, 28px); letter-spacing: 1px; }
.stepper, .modes { display: flex; align-items: center; gap: 14px; }
.stepper { color: #cfd8d2; font-size: 14px; }
.stepper button, .modebtn { border: 1px solid #ffffff2a; border-radius: 10px; background: linear-gradient(160deg, #243a2e, #16241c); color: #eef2ee; cursor: pointer; }
.stepper button { width: 30px; height: 30px; font-size: 16px; }
.stepper span:last-of-type { min-width: 18px; color: var(--gold); font-weight: 700; text-align: center; }
.modebtn { padding: 14px 26px; font-size: 16px; transition: transform .15s, box-shadow .15s; }
.modebtn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px #0007; }
#hud { display: flex; align-items: center; justify-content: space-between; width: min(100%, 920px); padding: 6px 18px; border-radius: 12px; background: var(--panel); font-size: 15px; flex-shrink: 0; }
.score { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.score .r { color: var(--red); }.score .b { color: var(--blue); }
#turn { display: flex; align-items: center; gap: 8px; color: #cfd8d2; font-size: 14px; }
#turnDot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
#round { color: #9fb0a6; font-size: 13px; }
#canvasWrap { position: relative; flex: 1 1 auto; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; }
canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; aspect-ratio: 2 / 1; border-radius: 10px; box-shadow: 0 12px 30px #0009, inset 0 0 0 3px #ffffff1a; cursor: crosshair; touch-action: none; }
#goalFlash { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: clamp(28px, 7vw, 54px); font-weight: 800; letter-spacing: 2px; opacity: 0; pointer-events: none; text-shadow: 0 0 20px #000, 0 0 40px currentColor; transform: scale(.6); }
#restart { width: auto; margin-top: 0; padding-inline: 20px; flex-shrink: 0; }
[hidden] { display: none !important; }
@media (orientation: landscape) {
  #app { flex-direction: column; padding: 6px 10px; gap: 6px; }
  #start { padding: 18px 22px; }
  #hud { padding: 4px 12px; font-size: 13px; }
  #helpBtn { top: 8px; left: 8px; width: 32px; height: 32px; }
}
@media (orientation: portrait) {
  #app { padding: 12px 10px 16px; }
}
@media (max-width: 560px) { #app { padding-inline: 8px; } #start { width: min(100%, 420px); padding: 28px 16px; } .modes { gap: 8px; } .modebtn { padding-inline: 16px; } #hud { padding-inline: 10px; } }
