/* ===========================================================================
   ArbeeStudios - Elements Game
   Only what minigames.css does not already provide: this page's screen ids,
   the level map, the level intro, the question row, the mini periodic table
   and the done-screen tweaks. Values follow design/elements-game/README.md.
   =========================================================================== */

/* ---- screens ------------------------------------------------------------ */
/* minigames.css shows Hundred Split's screens by id; these are this page's. */
.mg-panel[data-screen="map"]   #elMap,
.mg-panel[data-screen="start"] #elStart,
.mg-panel[data-screen="play"]  #elPlay,
.mg-panel[data-screen="done"]  #elDone { display: block; }

/* The JS toggles `hidden` on elements that also carry a display value. */
#elPanel [hidden] { display: none !important; }

button, input, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Headings that receive focus from the script (tabindex="-1") show no ring. */
.el-h:focus, .el-title:focus { outline: none; }

/* A small white pill: "← All levels" and the table toggle. The ::after
   widens the tap target to 44px without changing how the pill looks. */
.el-pill {
  position: relative;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 13px; font-weight: 500; color: var(--ink);
  background: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
  padding: 7px 14px; box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}
.el-pill::after { content: ""; position: absolute; inset: -6px -3px; }

/* ---- level map ---------------------------------------------------------- */
.el-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.el-h { font-family: "Fredoka", system-ui, sans-serif; font-size: 21px; font-weight: 600; margin: 0; }
.el-count {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink); padding: 6px 14px; white-space: nowrap;
}
.el-bar {
  height: 14px; border: 2.5px solid var(--ink); border-radius: 999px;
  background: #FFF9EF; overflow: hidden; margin-bottom: 22px;
}
.el-bar-fill {
  height: 100%; width: 0; background: var(--c-green);
  border-right: 2.5px solid var(--ink);
  transition: width 0.4s ease;
}

.el-blocks { display: flex; flex-direction: column; gap: 22px; margin-top: 30px; }
.el-block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.el-block-title { font-family: "Fredoka", system-ui, sans-serif; font-size: 17px; font-weight: 600; margin: 0; }
.el-block-span { font-weight: 700; font-size: 13.5px; color: var(--ink-soft); }
.el-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }

.el-chip {
  text-align: left;
  font-family: "Nunito", system-ui, sans-serif; color: var(--ink);
  background: #FFF9EF; border: 2.5px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 10px 12px 11px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
}
.el-chip:hover { transform: translateY(-2px); }
.el-chip.is-next { background: var(--c-yellow); }
.el-chip.is-done { background: #EEFBE4; border-color: #5FA22B; box-shadow: 0 4px 0 #5FA22B; }
.el-chip-top { display: flex; align-items: center; gap: 8px; }
.el-chip-dot {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Fredoka", system-ui, sans-serif; font-size: 12px; font-weight: 600;
  background: #fff; border: 2.5px solid var(--ink);
}
.el-chip.is-done .el-chip-dot { background: var(--c-green); font-size: 13px; font-weight: 700; }
.el-chip-range {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.el-chip-mode { font-weight: 800; font-size: 13px; color: var(--ink-soft); line-height: 1.2; }

.el-reset-row { display: flex; justify-content: center; margin-top: 28px; }
.el-reset {
  position: relative;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  background: transparent; border: 0; border-bottom: 2.5px solid var(--c-pink);
  padding: 2px 0; cursor: pointer;
}
.el-reset::after { content: ""; position: absolute; inset: -13px -10px; }

/* ---- level intro -------------------------------------------------------- */
.el-toprow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 22px;
}
.el-cleared {
  font-family: "Fredoka", system-ui, sans-serif; font-size: 13px; font-weight: 500;
  color: var(--ink); background: #EEFBE4; border: 2.5px solid #5FA22B; border-radius: 999px;
  padding: 6px 13px;
}
.el-levelof { font-family: "Fredoka", system-ui, sans-serif; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.el-title {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(26px, 5vw, 34px); font-weight: 600; letter-spacing: -0.02em;
  margin: 2px 0 22px; line-height: 1.1;
}
.el-title .mode { color: var(--c-orange); }

.el-peek {
  width: 100%;
  font-family: "Fredoka", system-ui, sans-serif; font-size: 15px; font-weight: 500; color: var(--ink);
  background: #fff; border: 2.5px dashed var(--ink); border-radius: 18px;
  padding: 12px 18px; cursor: pointer; margin-bottom: 20px;
}

.el-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-bottom: 26px; }
.el-tile {
  background: var(--cat, #fff); color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  padding: 8px 10px 10px; display: flex; flex-direction: column; min-width: 0;
}
.el-tile-z { font-family: "Fredoka", system-ui, sans-serif; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.el-tile-sym { font-family: "Fredoka", system-ui, sans-serif; font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.el-tile-name { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The category legend, under the study tiles and under the table. */
.el-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-bottom: 22px;
  font-weight: 700; font-size: 12.5px; color: var(--ink-soft);
}
.el-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.el-legend i {
  flex: none; width: 11px; height: 11px; border-radius: 3px;
  border: 2px solid var(--ink); background: var(--cat, #fff);
}

/* ---- play --------------------------------------------------------------- */
.el-hud {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 22px;
}
.el-hud-level { font-family: "Fredoka", system-ui, sans-serif; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.el-hud-count {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.el-hud-count .of { color: var(--ink-soft); }

/* The question sits above the table so it stays visible over a phone keyboard. */
.el-q {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px;
  background: #FFF9EF; border: 2.5px solid var(--ink); border-radius: 18px; padding: 10px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.el-num {
  width: clamp(58px, 16vw, 68px); height: clamp(58px, 16vw, 68px);
  border-radius: 14px; background: var(--c-yellow);
  border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.el-num .lbl { font-family: "Fredoka", system-ui, sans-serif; font-size: 11px; font-weight: 600; color: var(--ink); }
.el-num .z {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(24px, 7vw, 28px); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
/* 20px keeps iOS from zooming in on focus (anything under 16px triggers it). */
.el-input {
  width: 100%; min-width: 0; min-height: 54px; margin: 0;
  font-family: "Fredoka", system-ui, sans-serif; font-size: 20px; font-weight: 600; color: var(--ink);
  background: #fff; border: 2.5px solid var(--ink); border-radius: 13px;
  padding: 8px 14px; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s ease;
}
.el-input::placeholder { color: #b0a8bd; font-weight: 600; }
.el-input:focus, .el-input:focus-visible { outline: none; }
.el-q.is-wrong { background: #FFF0F4; border-color: #D6336C; }
.el-q.is-wrong .el-input { border-color: #D6336C; }

.el-fb {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 12px 0 18px; min-height: 46px;
}
.el-fb-text { margin: 0; font-weight: 700; font-size: 14.5px; line-height: 1.35; color: var(--ink-soft); text-wrap: pretty; }
.el-fb-text.is-reveal { color: var(--c-violet-deep); }
.el-fb-text.is-wrong { color: #C22A5D; }
.el-fb-text.is-right { color: #4A8420; }
.el-reveal {
  flex: none; margin-left: auto;
  font-family: "Fredoka", system-ui, sans-serif; font-size: 15px; font-weight: 600; color: var(--ink);
  background: #fff; border: 2.5px solid var(--ink); border-radius: 999px;
  padding: 10px 18px; min-height: 46px; box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}

/* The table toggle: one small pill directly above the table's place. */
.el-tablebar { display: flex; justify-content: center; margin-bottom: 12px; }

/* 18 columns; row 8 is an 8px gap before the lanthanide and actinide rows. */
.el-table {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto) 8px repeat(2, auto);
  gap: clamp(1.5px, 0.6vw, 3px);
  margin-bottom: 10px;
}
.el-cell {
  aspect-ratio: 1; border-radius: 4px;
  background: transparent; border: 1.5px dashed #d9d2c6; color: transparent;
  display: grid; place-items: center; overflow: hidden;
  font-family: "Fredoka", system-ui, sans-serif; font-weight: 600;
  font-size: clamp(7px, 1.7vw, 11px); line-height: 1;
}
.el-cell.is-range { background: #fff; border: 2px solid var(--ink); color: var(--ink); }
.el-cell.is-solved { background: var(--cat, #fff); border: 2px solid var(--ink); color: var(--ink); }
.el-cell.is-cur {
  background: var(--c-violet-deep); border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--c-violet); color: #fff;
}

#elPlay .mg-hint { margin-top: 8px; }

/* ---- done --------------------------------------------------------------- */
.mg-cheer.is-slips { background: var(--c-pink); }
.mg-actions .el-next { flex: 1 1 100%; }

/* ---- responsive --------------------------------------------------------- */
/* Under 460px minigames.css already narrows the panel (20px 16px, radius 20)
   and stacks every .mg-actions button full width. The rest of this page is
   laid out for phones first and needs no further change there. */

@media (prefers-reduced-motion: reduce) {
  .el-chip:hover { transform: none; }
  .el-bar-fill { transition: none; }
}
