/* Study Royale — follower ladder.
   Brand look: flat sky blue, star gold, white bubble type in Fredoka One
   with thick black cartoon outlines — same language as the videos. */

@font-face {
  font-family: "Fredoka One";
  src: url("fonts/FredokaOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --blue: #58aeff;        /* the sky of the videos */
  --blue-deep: #3d97f2;
  --gold: #f5c544;        /* the coin / star gold */
  --gold-dark: #c9992e;
  --cream: #f4e3b2;
  --ink: #131313;         /* outline black */
  --paper: #ffffff;
  --radius: 22px;
  --font: "Fredoka One", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--blue);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 20px 40px;
}

.wrap { max-width: 580px; margin: 0 auto; }

/* ---------- outlined bubble text, like the logo ---------- */
.bubble {
  color: #fff;
  -webkit-text-stroke: 2.2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  letter-spacing: .02em;
}

/* ---------- header ---------- */
.head { text-align: center; }

.crown {
  display: block;
  width: 84px;
  height: auto;
  /* the crown tucks slightly INTO the wordmark, as in the logo, but the
     wordmark's own black outline needs room or the two collide */
  margin: 0 auto -4px;
}

.wordmark {
  font-size: clamp(24px, 6.4vw, 31px);
  letter-spacing: .04em;
  line-height: 1;
}

h1 {
  font-size: clamp(31px, 8vw, 44px);
  line-height: 1.05;
  margin: 22px 0 16px;      /* breathing room on BOTH sides: two lines of
                               outlined bubble type need it or they read
                               as one heavy block */
  font-weight: 400;
}

.sub {
  margin: 0 auto;
  max-width: 40ch;
  line-height: 1.45;
  color: #fff;
  font-size: 15px;
  font-family: var(--font);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}

/* ---------- search ---------- */
.searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 5px 5px 18px;
  margin: 30px 0 10px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
}

.at { color: var(--gold-dark); font-size: 18px; }

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font-size: 17px;
  padding: 12px 4px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
}

.searchbar button {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
  box-shadow: 0 3px 0 var(--gold-dark);
}
.searchbar button:hover { background: #ffd35d; }
.searchbar button:active { transform: translateY(2px); box-shadow: none; }

.hint {
  color: #fff;
  font-size: 14px;
  text-align: center;
  margin: 0 0 20px;
  min-height: 1.2em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}

/* ---------- result card ---------- */
.card {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 18px;
  align-items: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .28);
  animation: pop .28s cubic-bezier(.2, .9, .3, 1.4);
}

@keyframes pop {
  from { transform: scale(.94) translateY(8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

#char {
  width: 178px;
  height: 178px;
  flex: none;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: #eaf3ff;
}

.info { min-width: 0; }

.handle {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.rank {
  font-size: clamp(40px, 13vw, 58px);
  line-height: 1;
  margin: 2px 0 10px;
  color: var(--gold);
  -webkit-text-stroke: 2.4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #eaf3ff;
  color: var(--ink);
  white-space: nowrap;
}
.chip.level { background: var(--gold); }

.blurb {
  margin: 10px 0 0;
  font-size: 13px;
  color: #5a5a5a;
  font-family: var(--font);
}

/* ---------- actions ---------- */
.actions { display: flex; gap: 10px; margin-top: 16px; }

.actions button {
  flex: 1;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 15px 12px;
  font-size: 16px;
  font-family: var(--font);
  cursor: pointer;
  transition: transform .08s ease;
}
.actions button:active { transform: translateY(2px); box-shadow: none !important; }

.primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--gold-dark);
}
.ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}

/* ---------- newest three ---------- */
.newest { margin-top: 28px; }

.newest h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 12px;
}

.newrow { display: flex; gap: 10px; }

.newrow button {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 10px 8px 12px;
  cursor: pointer;
  font-family: var(--font);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
  transition: transform .08s ease;
}
.newrow button:active { transform: translateY(2px); box-shadow: none; }

.newrow canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #eaf3ff;
}

.newrow .nh {
  display: block;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.newrow .nr {
  display: block;
  font-size: 15px;
  margin-top: 10px;
  color: var(--ink);
}

.newrow .nh {
  color: var(--gold-dark);
  font-size: 13px;
}

/* ---------- not found ---------- */
.miss {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .28);
}
.miss h2 { margin: 0 0 6px; font-size: 20px; font-weight: 400; }
.miss p { margin: 0; font-size: 14px; font-family: var(--font); color: #444; }

.suggest { list-style: none; margin: 12px 0 0; padding: 0; }
.suggest li { margin-top: 6px; }
.suggest button {
  width: 100%;
  text-align: left;
  background: #eaf3ff;
  border: 2.5px solid var(--ink);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.suggest button:hover { background: var(--gold); }
.suggest .n { float: right; color: var(--gold-dark); }

/* ---------- footer ---------- */
.foot {
  margin-top: 30px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.foot .small {
  font-size: 12px;
  opacity: .92;
  max-width: 46ch;
  margin: 8px auto 0;
}

@media (max-width: 400px) {
  .card { flex-direction: column; text-align: center; }
  .chips { justify-content: center; }
  #char { width: 200px; height: 200px; }
}

/* ---------- level legend ---------- */
/* Stacked rows, not a side column: on a phone the page is one narrow
   strip, and a legend squeezed beside the card would be unreadable. */
.legend { margin-top: 30px; }

.legend h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 6px;
}

.legend-sub {
  text-align: center;
  color: #fff;
  font-size: 13px;
  margin: 0 auto 14px;
  max-width: 40ch;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}

.legend-list { list-style: none; margin: 0; padding: 0; }

.legend-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 8px 14px 8px 8px;
  margin-bottom: 8px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}

.legend-list li.locked { opacity: .55; }

.legend-list canvas,
.legend-list .qmark {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #eaf3ff;
}

.legend-list .qmark {
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--gold-dark);
}

.legend-list .lv { font-size: 15px; }
.legend-list .rg { display: block; font-size: 12px; color: #5a5a5a; }
.legend-list .now {
  margin-left: auto;
  font-size: 11px;
  background: var(--gold);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
