* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, sans-serif; background: #fffaf0; color: #1f2340; }
header { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; background: #ffd43b; padding: 16px 24px; border-bottom: 4px solid #1f2340; }
header a { color: inherit; text-decoration: none; font-weight: 700; }
header .logo { font-size: 28px; font-weight: 900; }
nav { display: flex; gap: 16px; }
main { max-width: 960px; margin: auto; padding: 24px 16px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: #fff; border: 3px solid #1f2340; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 0 #1f2340; margin-bottom: 8px; }
.thumb { height: 130px; display: grid; place-items: center; font-size: 56px; }
.info { padding: 16px; }
.info h2 { margin: 0 0 6px; font-size: 20px; }
.btn { display: inline-block; background: #3b5bfd; color: #fff; border: 0; border-radius: 10px; padding: 10px 20px; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; margin: 0 8px 8px 0; }
.bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
label { display: block; font-weight: 700; margin-bottom: 14px; }
input, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; border: 2px solid #1f2340; border-radius: 8px; background: #fff; }
iframe { width: 100%; height: 75vh; min-height: 420px; border: 3px solid #1f2340; border-radius: 12px; background: #000; }
select { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; border: 2px solid #1f2340; border-radius: 8px; background: #fff; }
.thumb img { width: 100%; height: 130px; object-fit: contain; }
.btn.off { background: #fff; color: #1f2340; border: 2px solid #1f2340; }
#chat { margin-top: 32px; }
#log { height: 260px; overflow-y: auto; background: #fff; border: 3px solid #1f2340; border-radius: 12px; padding: 4px 12px; margin-bottom: 8px; overflow-wrap: anywhere; }
#log p { margin: 8px 0; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 800; color: #3b5bfd; text-decoration: underline; cursor: pointer; }
ol { padding-left: 24px; }
body { background: var(--page, #fffaf0); color: var(--ink, #1f2340); }
header, .card, #log, .colors div { color: #1f2340; }
#box:not(:empty) { background: var(--stage, #fffaf0); padding: 16px; border-radius: 16px; }
.colors { position: relative; font-weight: 700; }
.colors summary { cursor: pointer; }
.colors div { position: absolute; right: 0; z-index: 5; width: 240px; padding: 16px; background: #fff; border: 3px solid #1f2340; border-radius: 12px; }
input[type=color] { height: 44px; padding: 2px; }
input[type=checkbox] { display: inline-block; width: auto; margin-right: 8px; }
.face { display: inline-block; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; text-align: center; line-height: 28px; }
.card { background: var(--card, #fff); color: var(--card-ink, #1f2340); }
.card .link { color: inherit; }
.thumb { background: var(--thumb, var(--game-color, #ff8787)); }
#wall { max-width: 420px; margin: 15vh auto; padding: 24px; background: #fff; color: #1f2340; border: 3px solid #1f2340; border-radius: 16px; font-weight: 700; text-align: center; }
dialog.profile { width: min(420px, 92vw); padding: 0; border: 3px solid #1f2340; border-radius: 16px; color: #1f2340; background: #fff; overflow-wrap: anywhere; }
.banner { height: 90px; display: flex; align-items: center; padding-left: 16px; }
.banner .face { width: 68px; height: 68px; line-height: 68px; font-size: 40px; background: #fff; }
.status { font-style: italic; }
.name { background: none; border: 0; padding: 0; font: inherit; font-weight: 800; cursor: pointer; }

/* First-visit download choice */
dialog.download-prompt {
  width: min(680px, 92vw);
  margin: auto;
  padding: 0;
  border: 3px solid #1f2340;
  border-radius: 20px;
  background: #fff;
  color: #1f2340;
  box-shadow: 0 10px 0 #1f2340;
}
dialog.download-prompt::backdrop {
  background: rgba(31, 35, 64, .55);
  backdrop-filter: blur(3px);
}
.download-prompt .prompt-head {
  background: #ffd43b;
  border-bottom: 3px solid #1f2340;
  padding: 18px 24px;
  font-size: 26px;
  font-weight: 900;
}
.download-prompt .prompt-body { padding: 24px; }
.download-prompt h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.1;
}
.download-prompt p { font-size: 17px; line-height: 1.5; margin: 0 0 14px; }
.download-prompt .prompt-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.download-prompt .btn { font-size: 17px; padding: 14px 22px; margin: 0; }

/* Big arrow after the download starts */
#downloadArrow { position: fixed; inset: 0; z-index: 10000; pointer-events: none; }
#downloadArrow .arrow-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#downloadArrow .arrow-line-bg {
  fill: none;
  stroke: #1f2340;
  stroke-width: 30;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#downloadArrow .arrow-line {
  fill: none;
  stroke: #ffd43b;
  stroke-width: 15;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 26 16;
  animation: htmlking-arrow-dash 1.1s linear infinite;
}
@keyframes htmlking-arrow-dash { to { stroke-dashoffset: -42; } }
#downloadArrow .arrow-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 54px;
  height: 54px;
  border: 3px solid #1f2340;
  border-radius: 50%;
  background: #fff;
  color: #1f2340;
  font: 900 34px/1 system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 0 #1f2340;
}
