:root{
  --bg:#0b1220;
  --ui:#0e1a2f;
  --ui2:#12284a;
  --txt:#e9f2ff;
  --muted:#b9c9e6;
  --accent:#7dd3fc;
}

*{ box-sizing:border-box; }
html,body{
  margin:0;
  height:100%;
  background:var(--bg);
  color:var(--txt);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow:hidden;
  touch-action:none;
}

#uiTop{
  position:fixed;
  top:0; left:0; right:0;
  display:flex;
  gap:10px;
  padding:10px;
  z-index:10;
  pointer-events:none;
}

#scoreBox, #guideBox{
  background:linear-gradient(180deg, rgba(18,40,74,.95), rgba(14,26,47,.95));
  border:1px solid rgba(125,211,252,.25);
  border-radius:12px;
  padding:10px 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

#scoreBox{
  min-width:240px;
  font-weight:800;
  letter-spacing:.2px;
}

#scoreBox .row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  line-height:1.25;
}

#scoreBox .k{ color:var(--muted); font-weight:700; font-size:12px; }
#scoreBox .v{ font-weight:900; }
#scoreBox .hs{ margin-top:6px; opacity:.95; }
/* When High Score label is removed, keep the line aligned nicely */
#scoreBox .row.hs{ justify-content:flex-start; }

#guideBox{
  /* Remove the "box" and let the arrow float centered */
  flex:0;
  min-width:0;
  background:transparent;
  border:none;
  box-shadow:none;
  padding:0;
  backdrop-filter:none;
}

#guideBox .label{
  display:none;
}

#arrowRow{
  display:block;
}

canvas#game{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  display:block;
}

/* START overlay */
#startOverlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:998;
}

#startDialog{
  width:min(520px, 92vw);
  background:linear-gradient(180deg, rgba(18,40,74,.98), rgba(14,26,47,.98));
  border:1px solid rgba(125,211,252,.25);
  border-radius:16px;
  padding:18px 16px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  text-align:left;
}

#startTitle{
  font-weight:1000;
  font-size:22px;
  margin-bottom:6px;
}

#startSub{
  color:var(--muted);
  font-size:13px;
  margin-bottom:14px;
}

#startTiny{
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
  opacity:.95;
}

#overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999;
}

/* id selectors (like #overlay) otherwise beat a plain .hidden class */
.hidden{ display:none !important; }

#overlay.hidden{ display:none !important; }
#startOverlay.hidden{ display:none !important; }

#dialog{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;   /* <-- detta centrerar vertikalt */
  text-align:center;        /* <-- detta centrerar horisontellt */
  width:min(520px, 92vw);
  background:linear-gradient(180deg, rgba(18,40,74,.98), rgba(14,26,47,.98));
  border:1px solid rgba(125,211,252,.25);
  border-radius:16px;
  padding:18px 16px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}

#dialogTitle{
  font-weight:900;
  font-size:18px;
  margin-bottom:14px;
}

/* Big score shown on death (same dialog as "Oops") */
#bigScore{
  font-size: clamp(48px, 9vw, 110px);
  font-weight: 1000;
  line-height: 1.0;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(0,0,0,.25), 0 18px 40px rgba(0,0,0,.18);
  margin: 10px 0 20px;
  letter-spacing: 1px;
  text-align:center;
}

/* When you set a new Highest Streak, the dialog gets a little extra sparkle */
#dialog.isCongrats{
  border-color: rgba(125,211,252,.55);
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}

#dialogButtons{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}

button{
  pointer-events:auto;
  border:0;
  border-radius:12px;
  padding:12px 14px;
  font-weight:900;
  cursor:pointer;
  background:rgba(125,211,252,.15);
  color:var(--txt);
  border:1px solid rgba(125,211,252,.35);
}

button:active{ transform:translateY(1px); }

#btnStart{
  background:rgba(125,211,252,.22);
}

#btnRetry{
  background:rgba(125,211,252,.22);
}
#btnQuit{
  background:rgba(248,113,113,.18);
  border-color: rgba(248,113,113,.35);
}

#tinyNote{
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
}

/* Global counter (top-right) */
#globalBox{
  margin-left:auto;
  min-width: 240px;
  text-align:right;
  background:linear-gradient(180deg, rgba(18,40,74,.95), rgba(14,26,47,.95));
  border:1px solid rgba(125,211,252,.25);
  border-radius:12px;
  padding:10px 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
#globalBox .gtitle{
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  letter-spacing:.2px;
}
#globalBox .gvalue{
  font-size: clamp(28px, 4.6vw, 52px);
  font-weight:1000;
  line-height:1.0;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  margin-top:6px;
}

#arrow{
  position: fixed !important;
  /* Place the guide arrow at 75% from the bottom (= 25% from the top). */
  top: calc(25vh + env(safe-area-inset-top, 0px)) !important;
  left: 50% !important;
  bottom: auto !important;

  transform: translate(-50%, -50%) !important;
  margin: 0 !important;

  font-size: clamp(120px, 16vw, 260px);
  font-weight: 1000;
  color: #c94848;
  text-shadow: 0 6px 0 rgba(0,0,0,.35), 0 18px 40px rgba(0,0,0,.35);
  letter-spacing: 2px;

  z-index: 9999 !important;
  pointer-events: none;
}

/* Phone layout: make left/right boxes split 50/50 and simplify text */
@media (max-width: 520px){
  #uiTop{ gap:8px; padding:8px; }

  /* Two columns: score (left) and world score (right). The arrow is on the playfield anyway. */
  #guideBox{ display:none; }

  #scoreBox, #globalBox{
    flex: 1 1 50%;
    min-width: 0;
    padding: 8px 10px;
  }

  #scoreBox .k{ font-size:11px; }
  #scoreBox .v{ font-size:12px; }

  #globalBox .gtitle{ font-size:11px; }
  #globalBox .gvalue{ font-size: clamp(22px, 7vw, 42px); }
}

/* Longest streak row */
#scoreBox .row.streak{ margin-top:4px; }


.gsub{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
  text-align:center;
}

/* Match Marc-line styling for the "Stones left" counter */
#stonesLeft{
  color: var(--txt);
  font-weight: 900;
  opacity: .95;
  text-align: right;
}

