* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #10203c 0%, #060b16 70%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#globe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#globe.dragging { cursor: grabbing; }

button {
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, .2); }
button:disabled { opacity: .4; cursor: default; }

header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(rgba(6, 11, 22, .85), rgba(6, 11, 22, 0));
  pointer-events: none;
}
header > * { pointer-events: auto; }
.brand { font-weight: 700; letter-spacing: .3px; }
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav input {
  font: inherit;
  color: #fff;
  color-scheme: dark;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  padding: 5px 8px;
}
.total { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.total small, .final small { font-weight: 400; opacity: .6; font-size: 12px; }

#prompt {
  position: fixed;
  top: 58px; left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  text-align: center;
  padding: 10px 18px;
  background: rgba(8, 14, 28, .78);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
#roundInfo { font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: .8px; }
#cityName { font-size: 22px; font-weight: 700; margin-top: 2px; }
#resultLine { font-size: 14px; margin-top: 4px; }
#resultLine:empty { display: none; }
#resultLine b { font-size: 18px; }

#action {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
#hint { font-size: 13px; opacity: .75; text-shadow: 0 1px 3px #000; }
#mainBtn {
  pointer-events: auto;
  font-size: 17px;
  font-weight: 700;
  padding: 11px 30px;
  border-radius: 999px;
  background: #ff8a1f;
  border-color: #ffb066;
}
#mainBtn:hover { background: #ff9c40; }
#mainBtn:disabled { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }

#zoomBtns {
  position: fixed;
  right: 14px; bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#zoomBtns button { width: 38px; height: 38px; padding: 0; font-size: 20px; }

#summary {
  position: fixed;
  top: 64px; right: 14px;
  width: 330px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 80px);
  overflow: auto;
  padding: 16px 18px;
  background: rgba(8, 14, 28, .88);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
#summary h2 { margin: 0 0 10px; font-size: 17px; }
#sumRounds { margin: 0; padding: 0; list-style: none; }
#sumRounds li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
#sumRounds .place { font-weight: 600; }
#sumRounds .dist { grid-column: 1; font-size: 12px; opacity: .65; }
#sumRounds .pts { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
#sumRounds .pts small { font-weight: 400; opacity: .6; }
.final { margin: 12px 0; font-size: 16px; }
.final b { font-size: 26px; margin-left: 6px; }
.sumBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 640px) {
  .brand { display: none; }
  .daynav button#todayBtn { display: none; }
  #cityName { font-size: 19px; }
  #summary { top: auto; bottom: 12px; left: 14px; right: 14px; width: auto; max-height: 55%; }
}

[hidden] { display: none !important; }

#earth {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#source {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  opacity: .8;
  white-space: nowrap;
}
#source:empty { display: none; }
#source.synced { background: rgba(34, 197, 94, .25); opacity: 1; }

#shareText {
  margin: 0 0 12px;
  padding: 9px 11px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, .07);
  border-radius: 10px;
  -webkit-user-select: text;
  user-select: text;
}

@media (max-width: 640px) {
  #source { display: none; }
}

.right { display: flex; align-items: center; gap: 12px; }

#authDialog {
  width: 320px;
  max-width: calc(100% - 28px);
  padding: 18px;
  color: #fff;
  background: rgba(8, 14, 28, .96);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 16px;
}
#authDialog::backdrop { background: rgba(0, 0, 0, .55); }
#authDialog h2 { margin: 0 0 12px; font-size: 17px; }
#authDialog label { display: block; margin-bottom: 10px; font-size: 13px; opacity: .9; }
#authDialog input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  -webkit-user-select: text;
  user-select: text;
}
#authError { min-height: 18px; margin: 0 0 10px; font-size: 13px; color: #ff8a80; }
.authBtns { display: flex; flex-wrap: wrap; gap: 8px; }
#loginBtn { background: #ff8a1f; border-color: #ffb066; font-weight: 700; }

@media (max-width: 640px) {
  .total small { display: none; }
}
