:root {
  --aw-bg-deep: #03100B;
  --aw-bg-mid: #061711;
  --aw-grass: #0F2A1E;
  --aw-grass-2: #143426;
  --aw-path: #2C3A33;
  --aw-path-glow: rgba(244, 196, 48, 0.18);
  --aw-stone: #C5C2B0;
  --aw-eire-green: #1F8A47;
  --aw-eire-orange: #FF7E33;
  --aw-gold: #F4C430;
  --aw-red: #C8302D;
  --aw-blue: #3CC5FF;
  --aw-text: #F5F7F2;
  --aw-muted: #8AA395;
  --aw-border: #1F2D26;
  --aw-display: 'Cinzel Decorative', 'Cinzel', serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  background: var(--aw-bg-deep);
  color: var(--aw-text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

/* Main world canvas — fills the viewport */
#world {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;
  cursor: default;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Top-left brand header */
.aw-header {
  position: fixed; top: 0; left: 0;
  z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  pointer-events: none; /* let through to canvas */
}
.aw-header > * { pointer-events: auto; }
.aw-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--aw-text);
  background: rgba(3, 16, 11, 0.72);
  border: 1px solid var(--aw-border);
  padding: 8px 14px; border-radius: 999px;
  font-size: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.aw-brand img { width: 22px; height: 22px; }
.aw-brand strong { color: var(--aw-eire-orange); }
.aw-brand span { font-family: var(--aw-display); letter-spacing: 0.06em; }
.aw-list-link {
  background: rgba(3, 16, 11, 0.72);
  border: 1px solid var(--aw-border);
  color: var(--aw-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 8px 12px; border-radius: 999px;
  backdrop-filter: blur(6px);
}
.aw-list-link:hover { color: var(--aw-eire-orange); border-color: var(--aw-eire-orange); }

/* Mini-map */
#minimap {
  position: fixed; top: 14px; right: 18px;
  z-index: 20;
  border: 1px solid var(--aw-border);
  border-radius: 10px;
  background: rgba(3, 16, 11, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  width: 220px; height: 148px;
  pointer-events: none;
}

/* Kiosk interaction prompt */
.aw-prompt {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, calc(-50% - 60px));
  z-index: 15;
  display: flex; align-items: center; gap: 10px;
  background: rgba(3, 16, 11, 0.92);
  border: 1px solid var(--aw-gold);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 800; font-size: 14px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(244, 196, 48, 0.22), 0 0 0 1px rgba(244, 196, 48, 0.08) inset;
  animation: awPromptPulse 1.5s ease-in-out infinite;
}
.aw-prompt[hidden] { display: none; }
.aw-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: var(--aw-gold); color: var(--aw-bg-deep);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; font-weight: 800;
  box-shadow: 0 2px 0 #B58E1A;
}
.aw-prompt-text { color: var(--aw-text); }
@keyframes awPromptPulse {
  0%, 100% { transform: translate(-50%, calc(-50% - 60px)); }
  50%      { transform: translate(-50%, calc(-50% - 66px)); }
}

/* Mobile thumbstick — bottom-left */
.aw-thumb {
  position: fixed; left: 22px; bottom: 22px;
  width: 132px; height: 132px;
  z-index: 25;
  display: none; /* shown via JS on touch devices */
  touch-action: none;
}
.aw-thumb-base {
  position: absolute; inset: 0;
  background: rgba(3, 16, 11, 0.55);
  border: 2px solid rgba(31, 138, 71, 0.45);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.aw-thumb-knob {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--aw-eire-green), var(--aw-gold));
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* Mobile action button (E) — bottom-right */
.aw-action-btn {
  position: fixed; right: 22px; bottom: 38px;
  z-index: 25;
  display: none;
  width: 84px; height: 84px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--aw-eire-green) 0%, var(--aw-gold) 60%, var(--aw-eire-orange) 100%);
  border: 2px solid rgba(255,255,255,0.2);
  color: var(--aw-bg-deep);
  font: 900 28px/1 var(--aw-display);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.aw-action-btn:active { transform: scale(0.95); }
.aw-action-btn.disabled { opacity: 0.4; }

/* Welcome hint */
.aw-hint {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(3, 16, 11, 0.92);
  border: 1px solid var(--aw-border);
  border-radius: 14px;
  padding: 14px 20px;
  text-align: center;
  max-width: 540px; width: calc(100% - 36px);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
  animation: awHintIn 0.5s ease-out;
}
@keyframes awHintIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translateX(-50%); } }
.aw-hint p { margin: 4px 0; font-size: 13px; }
.aw-hint p:first-child { font-family: var(--aw-display); font-size: 16px; letter-spacing: 0.04em; color: var(--aw-eire-orange); }
.aw-hint kbd {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--aw-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font: 700 11px/1 'JetBrains Mono', monospace;
  color: var(--aw-eire-orange);
}
.aw-hint-controls { color: var(--aw-muted); font-size: 12px; }
.aw-hint-mobile { display: none; }
.aw-hint-x {
  margin-top: 8px;
  background: var(--aw-eire-green);
  color: var(--aw-bg-deep);
  border: 0;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 800; font-size: 12px;
  cursor: pointer;
}
.aw-hint-x:hover { filter: brightness(1.1); }
.aw-hint.dismissed { animation: awHintOut 0.35s ease-in forwards; pointer-events: none; }
@keyframes awHintOut { to { opacity: 0; transform: translate(-50%, 12px); } }

/* Entry fade overlay (when entering a game) */
.aw-entry-fade {
  position: fixed; inset: 0;
  z-index: 100;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.7) 60%, var(--aw-bg-deep) 100%);
  opacity: 0;
  pointer-events: none;
}
.aw-entry-fade.active {
  pointer-events: auto;
  animation: awEntryFade 0.55s ease-out forwards;
}
@keyframes awEntryFade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* Aoife the Guide — skip-tour button */
.aw-tour-skip {
  position: fixed; right: 16px; bottom: 90px;
  z-index: 18;
  background: rgba(3, 16, 11, 0.92);
  border: 1px solid var(--aw-border);
  color: var(--aw-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font: 700 12px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.aw-tour-skip:hover { color: var(--aw-eire-orange); border-color: var(--aw-eire-orange); }
@media (max-width: 600px) {
  .aw-tour-skip { bottom: 220px; right: 12px; }
}

/* Town Hall chat panel */
.aw-chat-panel {
  position: fixed; left: 16px; bottom: 16px;
  z-index: 18;
  width: 300px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  background: rgba(3, 16, 11, 0.86);
  border: 1px solid var(--aw-border);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.5);
  overflow: hidden;
  font: 500 13px/1.4 'Inter', system-ui, sans-serif;
}
.aw-chat-panel.collapsed { width: 160px; }
.aw-chat-panel.collapsed .aw-chat-feed,
.aw-chat-panel.collapsed .aw-chat-form,
.aw-chat-panel.collapsed .aw-chat-hint { display: none; }
.aw-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 8px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--aw-border);
}
.aw-chat-title {
  font: 700 12px/1 var(--aw-display);
  letter-spacing: 0.16em;
  color: var(--aw-gold);
}
.aw-chat-collapse {
  background: transparent; border: 0;
  color: var(--aw-muted); font-size: 16px; line-height: 1;
  width: 22px; height: 22px; border-radius: 6px;
  cursor: pointer; padding: 0;
}
.aw-chat-collapse:hover { background: rgba(255,255,255,0.06); color: var(--aw-text); }
.aw-chat-feed {
  flex: 1; min-height: 130px; max-height: 240px;
  overflow-y: auto; overflow-x: hidden;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.aw-chat-feed::-webkit-scrollbar { width: 6px; }
.aw-chat-feed::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 6px; }
.aw-chat-msg { margin-bottom: 6px; word-wrap: break-word; }
.aw-chat-msg .aw-chat-name { font-weight: 800; margin-right: 4px; }
.aw-chat-msg.is-player .aw-chat-name { color: var(--aw-eire-green); }
.aw-chat-msg.is-anon   .aw-chat-name { color: var(--aw-muted); }
.aw-chat-msg.is-self   .aw-chat-name { color: var(--aw-gold); }
.aw-chat-msg .aw-chat-text { color: var(--aw-text); }
.aw-chat-form {
  display: flex; gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--aw-border);
}
#chat-input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--aw-border);
  color: var(--aw-text);
  padding: 9px 10px;
  border-radius: 8px;
  font: 500 13px/1.2 'Inter', system-ui, sans-serif;
}
#chat-input:focus { outline: 0; border-color: var(--aw-eire-green); }
#chat-input:disabled { opacity: 0.6; cursor: not-allowed; }
#chat-send {
  background: var(--aw-eire-green);
  border: 0; color: #0A1410;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}
#chat-send:hover { filter: brightness(1.1); }
.aw-chat-hint {
  margin: 0 0 8px 12px;
  color: var(--aw-eire-orange);
  font-size: 11px;
}

@media (max-width: 600px) {
  .aw-chat-panel { width: calc(100vw - 32px); left: 16px; bottom: 12px; }
  .aw-chat-feed { max-height: 130px; }
}

/* Anon-user welcome gate */
.aw-auth-gate {
  position: fixed; inset: 0;
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: radial-gradient(circle at center, rgba(0,0,0,0.55) 0%, rgba(3,16,11,0.96) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.25s ease-out;
  animation: awAuthIn 0.3s ease-out forwards;
}
.aw-auth-gate[hidden] { display: none; }
@keyframes awAuthIn { to { opacity: 1; } }
.aw-auth-card {
  position: relative;
  background: rgba(3, 16, 11, 0.97);
  border: 1px solid rgba(244, 196, 48, 0.5);
  border-radius: 16px;
  padding: 30px 28px 22px;
  max-width: 520px; width: 100%;
  max-height: 92vh; overflow: auto;
  box-shadow: 0 26px 70px rgba(0,0,0,0.65), 0 0 0 1px rgba(244,196,48,0.10) inset;
  text-align: center;
}
.aw-auth-title {
  margin: 0 0 4px;
  font: 900 30px/1.05 var(--aw-display);
  letter-spacing: 0.04em;
  color: var(--aw-gold);
  text-shadow: 0 2px 14px rgba(244,196,48,0.4);
}
.aw-auth-tag {
  margin: 0 0 22px;
  color: var(--aw-muted);
  font-family: var(--aw-serif);
  font-size: 13px; letter-spacing: 0.18em;
}
.aw-auth-benefits {
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(31, 138, 71, 0.28);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.aw-auth-benefits-h {
  margin: 0 0 10px;
  text-align: center;
  color: var(--aw-eire-green);
  font: 800 12px/1 'Inter', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.aw-auth-benefits ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.aw-auth-benefits li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.aw-auth-benefits li > span:first-child { font-size: 18px; line-height: 1.2; flex-shrink: 0; width: 24px; text-align: center; }
.aw-auth-benefits li .muted { color: var(--aw-muted); font-size: 11px; }
.aw-auth-cta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.aw-auth-primary, .aw-auth-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 22px; border-radius: 999px;
  font: 800 14px/1 'Inter', sans-serif;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.aw-auth-primary {
  background: linear-gradient(135deg, var(--aw-eire-green) 0%, var(--aw-gold) 60%, var(--aw-eire-orange) 100%);
  color: #0A1410;
  box-shadow: 0 10px 28px rgba(31,138,71,0.35);
  font-weight: 900;
}
.aw-auth-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.aw-auth-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--aw-border);
  color: var(--aw-text);
}
.aw-auth-secondary:hover { border-color: var(--aw-eire-green); color: var(--aw-eire-green); }
.aw-auth-guest {
  margin-top: 6px;
  background: transparent; border: 0;
  color: var(--aw-muted);
  font: 600 12px/1 'Inter', sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px 12px;
}
.aw-auth-guest:hover { color: var(--aw-eire-orange); }
.aw-auth-footnote {
  margin: 4px 0 0;
  color: var(--aw-muted);
  font-size: 11px;
}

@media (max-width: 480px) {
  .aw-auth-card { padding: 22px 18px 18px; }
  .aw-auth-title { font-size: 24px; }
  .aw-auth-benefits li { font-size: 12px; }
}

/* Arcade Plaza sub-menu */
.aw-arcade-menu {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: radial-gradient(circle at center, rgba(0,0,0,0.55) 0%, rgba(3,16,11,0.92) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.aw-arcade-menu[hidden] { display: none; }
.aw-arcade-menu.active { opacity: 1; }
.aw-arcade-card {
  position: relative;
  background: rgba(3, 16, 11, 0.95);
  border: 1px solid rgba(244, 196, 48, 0.45);
  border-radius: 16px;
  padding: 28px 28px 24px;
  max-width: 720px; width: 100%;
  max-height: 85vh; overflow: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(244,196,48,0.10) inset;
  transform: translateY(8px);
  transition: transform 0.25s ease-out;
}
.aw-arcade-menu.active .aw-arcade-card { transform: translateY(0); }
.aw-arcade-close {
  position: absolute; top: 12px; right: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--aw-border);
  color: var(--aw-muted);
  width: 32px; height: 32px; border-radius: 999px;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.aw-arcade-close:hover { color: var(--aw-eire-orange); border-color: var(--aw-eire-orange); }
.aw-arcade-title {
  margin: 0 0 4px;
  font: 900 28px/1.1 var(--aw-display);
  letter-spacing: 0.04em;
  color: var(--aw-gold);
  text-align: center;
  text-shadow: 0 2px 12px rgba(244,196,48,0.35);
}
.aw-arcade-sub { margin: 0 0 20px; text-align: center; color: var(--aw-muted); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }
.aw-arcade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.aw-arcade-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--aw-border);
  border-radius: 12px;
  color: var(--aw-text);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease;
  font-family: inherit;
}
.aw-arcade-tile:hover {
  transform: translateY(-2px);
  border-color: var(--aw-gold);
  background: rgba(244,196,48,0.08);
}
.aw-arcade-tile:active { transform: translateY(0); }
.aw-arcade-icon { font-size: 28px; line-height: 1; }
.aw-arcade-label { font: 700 12px/1.2 var(--aw-serif); letter-spacing: 0.04em; }

/* Touch device tweaks */
@media (pointer: coarse) {
  .aw-thumb { display: block; }
  .aw-action-btn { display: flex; align-items: center; justify-content: center; }
  .aw-hint-desktop { display: none; }
  .aw-hint-mobile { display: inline; }
  #minimap { width: 140px; height: 94px; top: 12px; right: 12px; }
  .aw-prompt { transform: translate(-50%, calc(-50% - 80px)); font-size: 12px; padding: 8px 14px; }
}

/* Smaller phones */
@media (max-width: 480px) {
  .aw-brand { padding: 6px 10px; font-size: 12px; }
  .aw-brand img { width: 18px; height: 18px; }
  .aw-list-link { padding: 6px 10px; font-size: 11px; }
}
