.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: #020b1b;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(0, 100, 255, 0.2), transparent 52%),
    linear-gradient(rgba(0, 140, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 140, 255, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #071a3b, #020817 58%, #061634);
  background-size: auto, 32px 32px, 32px 32px, auto;
  color: #eaf6ff;
  font-family: "Rajdhani", "Trebuchet MS", sans-serif;
}
main {
  width: min(1120px, calc(100% - 48px));
  margin: 16px auto 72px;
}
main.app {
  position: relative;
  isolation: isolate;
  padding: 16px 20px 56px;
}
main.app::before {
  position: fixed;
  inset: 8px;
  z-index: -1;
  border: 1px solid rgba(0, 173, 255, 0.36);
  clip-path: polygon(2.5% 0, 97.5% 0, 100% 6%, 100% 94%, 97.5% 100%, 2.5% 100%, 0 94%, 0 6%);
  box-shadow: inset 0 0 28px rgba(0, 119, 255, 0.16), 0 0 18px rgba(0, 153, 255, 0.22);
  content: "";
  pointer-events: none;
}
.rules-dialog {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #00cfff;
  border-radius: 4px;
  background: linear-gradient(145deg, #082552, #020c22 78%);
  color: #eaf6ff;
  box-shadow: 0 0 28px rgba(0, 174, 255, 0.4), inset 0 0 24px rgba(0, 109, 255, 0.14);
}
.rules-dialog::backdrop {
  background: rgba(0, 4, 14, 0.88);
  backdrop-filter: blur(5px);
}
.rules-dialog-content {
  max-height: min(90vh, 900px);
  overflow-y: auto;
  padding: 28px 32px 24px;
}
.rules-dialog-header {
  margin-bottom: 20px;
  text-align: center;
}
.rules-eyebrow {
  margin: 0 0 8px;
  color: #69eaff;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
}
.rules-dialog-header h1 {
  margin: 0;
  color: #f1fbff;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: clamp(22px, 5vw, 32px);
  text-shadow: 0 0 10px #087cff;
}
.rules-dialog-header > p:last-child {
  margin: 10px 0 0;
  color: #c7eaff;
  font-size: 18px;
}
.rules-section {
  margin-top: 18px;
}
.rules-section h2 {
  margin: 0 0 8px;
  color: #69eaff;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 19px;
}
.rules-section ol,
.rules-section ul {
  margin: 0;
  padding-left: 25px;
  color: #e2f3ff;
  font-size: 17px;
  line-height: 1.4;
}
.rules-section li {
  padding-left: 4px;
  margin: 0 0 7px;
}
.rules-dialog-footer {
  position: sticky;
  bottom: -24px;
  display: grid;
  gap: 14px;
  margin: 20px -32px -24px;
  padding: 16px 32px 24px;
  border-top: 1px solid rgba(0, 207, 255, 0.35);
  background: #04152d;
}
.rules-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.rules-agreement input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: #00b8e6;
}
#rules-continue {
  min-height: 46px;
  border: 1px solid #00d9ff;
  border-radius: 3px;
  background: linear-gradient(135deg, #0074dc, #004ca8);
  color: #fff;
  font: 700 18px "Rajdhani", "Trebuchet MS", sans-serif;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 174, 255, 0.24);
}
#rules-continue:disabled {
  border-color: #506274;
  background: #283746;
  color: #a8b4bf;
  cursor: not-allowed;
  box-shadow: none;
}
header {
  text-align: center;
}
.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 128px;
  margin-bottom: 12px;
}
.site-logo {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: min(100%, 300px);
  max-height: 120px;
  object-fit: contain;
  filter: brightness(2.4) saturate(1.2) drop-shadow(0 0 10px rgba(0, 153, 255, 0.28));
}
.event-logo {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: min(100%, 270px);
  max-height: 108px;
  object-fit: contain;
  margin-right: 30px;
}
.page-heading {
  grid-column: 2;
  grid-row: 1;
}
header h1 {
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 38px;
  margin: 0;
  color: #f1fbff;
  text-shadow: 0 0 8px #008cff, 0 0 22px rgba(0, 153, 255, 0.78);
}
.page-header p {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 28px;
  border: 1px solid rgba(0, 194, 255, 0.8);
  background: rgba(2, 25, 62, 0.78);
  color: #d8f4ff;
  font-size: 18px;
  line-height: 1.2;
  clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
  box-shadow: 0 0 12px rgba(0, 195, 255, 0.32);
}
.apk-download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid rgba(0, 194, 255, 0.55);
  background: rgba(2, 25, 62, 0.78);
}
.apk-download-panel[hidden] {
  display: none;
}
.apk-download-panel strong {
  color: #f1fbff;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 14px;
}
.apk-download-panel p {
  margin: 4px 0 0;
  color: #c7eaff;
  font-size: 16px;
}
.offline-app-notice {
  margin: 0 0 14px;
  color: #c7eaff;
  font-size: 16px;
  text-align: center;
}
.apk-download-button {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid #00d9ff;
  border-radius: 3px;
  background: linear-gradient(135deg, #0074dc, #004ca8);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(0, 174, 255, 0.24);
}
.apk-download-button:hover,
.apk-download-button:focus-visible {
  background: linear-gradient(145deg, #1262ba, #082653);
  outline: 2px solid #28dfff;
  outline-offset: 2px;
}
.card {
  position: relative;
  background:
    linear-gradient(rgba(0, 122, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 122, 255, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, rgba(8, 37, 82, 0.97), rgba(2, 12, 34, 0.98));
  background-size: 20px 20px, 20px 20px, auto;
  border: 1px solid rgba(0, 166, 255, 0.76);
  border-radius: 3px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: inset 0 0 24px rgba(0, 109, 255, 0.12), 0 0 12px rgba(0, 140, 255, 0.15);
}
.setup {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 30px 52px 28px;
  border: 1px solid rgba(0, 182, 255, 0.82);
  background:
    radial-gradient(ellipse at 48% 12%, rgba(0, 106, 255, 0.16), transparent 68%),
    linear-gradient(rgba(0, 122, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 122, 255, 0.06) 1px, transparent 1px),
    linear-gradient(150deg, rgba(5, 30, 73, 0.98), rgba(1, 11, 31, 0.98));
  background-size: auto, 22px 22px, 22px 22px, auto;
  clip-path: polygon(3.5% 0, 96.5% 0, 100% 7%, 100% 93%, 96.5% 100%, 3.5% 100%, 0 93%, 0 7%);
  box-shadow: inset 0 0 30px rgba(0, 125, 255, 0.2), 0 0 16px rgba(0, 170, 255, 0.23);
}
.setup::before {
  position: absolute;
  inset: 7px;
  z-index: -1;
  border: 1px solid rgba(0, 156, 255, 0.25);
  clip-path: polygon(3.5% 0, 96.5% 0, 100% 7%, 100% 93%, 96.5% 100%, 3.5% 100%, 0 93%, 0 7%);
  content: "";
  pointer-events: none;
}
.setup-header {
  width: 100%;
}
.setup-header h3 {
  margin: 0;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  color: #eefaff;
  text-shadow: 0 0 10px #087cff, 0 0 24px rgba(0, 168, 255, 0.58);
}
.setup-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 28px;
  row-gap: 16px;
  align-items: start;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-full {
  grid-column: 1 / -1;
}
.setup-form label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  color: #eaf6ff;
  text-shadow: 0 0 8px rgba(0, 132, 255, 0.35);
}
.setup-form label::before {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #00cfff;
  background: rgba(0, 130, 255, 0.12);
  color: #9af4ff;
  font-size: 18px;
  line-height: 1;
  clip-path: polygon(24% 0, 76% 0, 100% 50%, 76% 100%, 24% 100%, 0 50%);
  box-shadow: 0 0 10px rgba(0, 185, 255, 0.25);
}
.setup-form label[for="firstName"]::before,
.setup-form label[for="lastName"]::before {
  content: "";
  background-image:
    radial-gradient(circle at 50% 34%, #9af4ff 0 4px, transparent 4.5px),
    radial-gradient(ellipse at 50% 95%, #9af4ff 0 9px, transparent 9.5px);
}
.setup-form label[for="middleInitial"]::before {
  content: "MI";
  font-size: 14px;
}
.setup-form label[for="limit"]::before {
  content: "";
  background-image:
    radial-gradient(circle, transparent 0 8px, #9af4ff 8.5px 10px, transparent 10.5px),
    linear-gradient(#9af4ff, #9af4ff),
    linear-gradient(#9af4ff, #9af4ff);
  background-position: center, center 36%, 58% 59%;
  background-size: 100% 100%, 2px 7px, 6px 2px;
  background-repeat: no-repeat;
}
.setup-form input,
.setup-form select {
  width: 100%;
  height: 56px;
  padding: 12px 18px;
  border: 1px solid #00c8ff;
  border-radius: 3px;
  background: linear-gradient(100deg, rgba(10, 41, 88, 0.98), rgba(4, 22, 54, 0.98));
  font: inherit;
  font-size: 18px;
  color: #effaff;
  outline: none;
  box-shadow: inset 0 0 14px rgba(0, 122, 255, 0.19), 0 0 6px rgba(0, 205, 255, 0.28);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.setup-form input:focus,
.setup-form select:focus {
  border-color: #b1f6ff;
  box-shadow: inset 0 0 14px rgba(0, 122, 255, 0.22), 0 0 0 2px rgba(0, 202, 255, 0.27), 0 0 18px rgba(0, 194, 255, 0.45);
}
.setup-form select {
  appearance: none;
  color-scheme: dark;
  background-image: linear-gradient(45deg, transparent 50%, #70eaff 50%), linear-gradient(135deg, #70eaff 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
.setup-form select option {
  background-color: #04152e;
  color: #effaff;
}
.setup-form input::placeholder {
  color: #8daecc;
}
.field-inline {
  max-width: 100%;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}
.stats div {
  background: linear-gradient(140deg, #0a3679, #04152e);
  border: 1px solid #008dff;
  color: #dff7ff;
  border-radius: 3px;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  box-shadow: inset 0 0 16px rgba(0, 143, 255, 0.18), 0 0 10px rgba(0, 132, 255, 0.15);
}
.stats b {
  display: block;
  font-size: 28px;
  margin-top: 5px;
  color: #fff;
  text-shadow: 0 0 12px #008cff;
}
#passage {
  color: #d4eaff;
  font: 18px/1.7 "Rajdhani", "Trebuchet MS", sans-serif;
}
.buttons,
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.row {
  justify-content: space-between;
}
button {
  padding: 11px 16px;
  border: 1px solid #00bfff;
  border-radius: 3px;
  background: linear-gradient(145deg, #0b3b82, #061b3d);
  color: #e8faff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: inset 0 0 12px rgba(0, 143, 255, 0.15), 0 0 8px rgba(0, 153, 255, 0.16);
  transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
button:hover:not(:disabled) {
  background: linear-gradient(145deg, #1262ba, #082653);
  box-shadow: inset 0 0 15px rgba(0, 198, 255, 0.24), 0 0 14px rgba(0, 185, 255, 0.32);
  transform: translateY(-1px);
}
#start {
  border-color: #9af4ff;
  background: linear-gradient(120deg, #05a8ff, #0756d7);
  color: white;
}
button:disabled {
  opacity: 0.4;
}
.certificate-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.row-certificate,
.row-qr {
  padding: 8px 10px;
  font-size: 12px;
}
.row-qr {
  background: #eef4ff;
  border-color: #bfd4ff;
  color: #173f67;
}
.scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}
th,
td {
  padding: 10px;
  border-bottom: 1px solid rgba(0, 166, 255, 0.3);
  text-align: left;
}
th {
  color: #67eaff;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  font-size: 12px;
}
#results td {
  color: #d7ebff;
}
#msg {
  color: #a9d7ff;
}
#msg.failed {
  color: #b42318;
  font-weight: bold;
}
.typing-wrap {
  position: relative;
  margin-top: 7px;
  border: 1px solid #00bfff;
  border-radius: 3px;
  background: #03132e;
  min-height: 250px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 119, 255, 0.16), 0 0 10px rgba(0, 153, 255, 0.18);
}
.typing-wrap textarea,
#typing-guide {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 18px 20px;
  border: 0;
  border-radius: 10px;
  font: 18px/1.7 "Rajdhani", "Trebuchet MS", sans-serif;
  letter-spacing: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}
.typing-wrap textarea {
  position: relative;
  z-index: 2;
  display: block;
  resize: none;
  overflow: auto;
  background: transparent;
  color: transparent;
  caret-color: #9af4ff;
  text-shadow: 0 0 0 rgba(17, 24, 39, 0);
}
.typing-wrap textarea:disabled {
  opacity: 1;
  background: #03132e;
  color: transparent;
}
.typing-wrap textarea::selection {
  background: rgba(72, 126, 180, 0.2);
  color: transparent;
}
#typing-guide {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  color: #7797bc;
  pointer-events: none;
  display: block;
}
.typing-wrap #typing-guide .correct {
  color: #effaff;
  text-shadow: 0 0 8px rgba(0, 213, 255, 0.72);
}
.typing-wrap #typing-guide .incorrect {
  color: #ff657f;
  text-shadow: 0 0 8px rgba(255, 46, 94, 0.6);
}
.floating-timer {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 20;
  display: grid;
  gap: 3px;
  min-width: 112px;
  padding: 10px 14px;
  border: 1px solid #00cfff;
  border-radius: 3px;
  background: linear-gradient(145deg, #0a3b83, #03142e);
  color: #fff;
  text-align: center;
  box-shadow: 0 0 10px rgba(0, 167, 255, 0.48), inset 0 0 14px rgba(0, 131, 255, 0.18);
  clip-path: polygon(8% 0, 92% 0, 100% 15%, 100% 85%, 92% 100%, 8% 100%, 0 85%, 0 15%);
}
.floating-mascot-wrap {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 19;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}
.floating-mascot {
  display: block;
  width: clamp(100px, 12vw, 160px);
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
  cursor: pointer;
  pointer-events: auto;
}
.floating-mascot img {
  display: block;
  width: 100%;
  max-height: 26vh;
  object-fit: contain;
}
.floating-mascot:focus-visible {
  outline: 3px solid #28dfff;
  outline-offset: 3px;
  border-radius: 50%;
}
.mascot-message {
  width: min(240px, calc(100vw - 36px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #33dfff;
  border-radius: 3px;
  background: rgba(3, 20, 48, 0.96);
  color: #dffaff;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 0 15px rgba(0, 174, 255, 0.32), inset 0 0 14px rgba(0, 108, 255, 0.15);
  clip-path: polygon(5% 0, 95% 0, 100% 15%, 100% 85%, 95% 100%, 5% 100%, 0 85%, 0 15%);
}
.floating-timer span {
  font-size: 10px;
  font-weight: bold;
}
.floating-timer b {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  font-family: "Orbitron", "Trebuchet MS", sans-serif;
  text-shadow: 0 0 12px #00cfff;
}
.floating-timer.urgent {
  border-color: #ff5876;
  background: linear-gradient(145deg, #91213d, #390d25);
  animation: timer-blink 0.8s steps(2, start) infinite;
}
@keyframes timer-blink {
  to { visibility: hidden; }
}
@media (max-width: 600px) {
  .apk-download-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .apk-download-button {
    width: 100%;
  }
  .rules-dialog-content {
    padding: 22px 18px 18px;
  }
  .rules-section ol,
  .rules-section ul {
    padding-left: 22px;
    font-size: 16px;
  }
  .rules-dialog-footer {
    bottom: -18px;
    margin: 18px -18px -18px;
    padding: 14px 18px 18px;
  }
  main {
    width: 100%;
    margin: 0 auto 32px;
  }
  main.app {
    width: 100%;
    padding: 10px 12px 130px;
  }
  main.app::before {
    inset: 4px;
    clip-path: polygon(5% 0, 95% 0, 100% 3%, 100% 97%, 95% 100%, 5% 100%, 0 97%, 0 3%);
  }
  .setup {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px 20px;
    clip-path: polygon(7% 0, 93% 0, 100% 4%, 100% 96%, 93% 100%, 7% 100%, 0 96%, 0 4%);
  }
  .setup-header h3 {
    font-size: 27px;
    line-height: 1.2;
  }
  .setup-form {
    row-gap: 4px;
  }
  .setup-form label {
    font-size: 17px;
  }
  .setup-form label::before {
    flex-basis: 28px;
    height: 26px;
  }
  .setup-form input,
  .setup-form select {
    height: 44px;
    font-size: 16px;
  }
  .card {
    padding: 16px;
    margin: 14px 0;
  }
  .card h2 {
    font-size: 20px;
  }
  #passage {
    font-size: 16px;
  }
  .typing-wrap textarea,
  #typing-guide {
    padding: 14px;
    font-size: 16px;
  }
  .stats div {
    padding: 10px 8px;
  }
  .stats b {
    font-size: 23px;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
    margin-top: 18px;
  }
  .setup-left h3 {
    font-size: 30px;
  }
  .floating-timer {
    top: 8px;
    right: 8px;
    min-width: 86px;
    padding: 7px 10px;
  }
  .floating-timer b {
    font-size: 20px;
  }
  .floating-mascot-wrap {
    left: 8px;
    right: auto;
    bottom: 8px;
    justify-items: start;
  }
  .floating-mascot {
    width: min(18vw, 70px);
  }
  .floating-mascot img {
    transform: scaleX(-1);
  }
  .mascot-message {
    width: min(260px, calc(100vw - 16px));
  }
  .page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding-top: 72px;
  }
  .site-logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    width: min(44vw, 220px);
    max-height: 86px;
  }
  .event-logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: min(44vw, 220px);
    max-height: 86px;
    margin-right: 0;
  }
  .page-heading {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
  .page-header h1 {
    font-size: 25px;
  }
  .page-header p {
    margin: 8px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .floating-timer.urgent {
    animation-duration: 1.6s;
  }
}
