/* ============================================================
   Lootbox ID — Tes Perangkat (tester.php)
   Builds on style.css tokens: --ink, --red, --yellow, --hard …
   ============================================================ */

/* ── Header ── */
.tester-hero {
  padding: 3rem 0 2rem; text-align: center;
  opacity: 0; animation: rise .8s .1s cubic-bezier(.2,.8,.2,1) forwards;
}
.tester-hero h1 {
  font-family: 'Baloo 2', cursive; font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 0.95;
  letter-spacing: -0.02em; color: var(--ink); margin-bottom: 1rem;
}
.tester-hero h1 .line-red { color: var(--red); }
.tester-hero .hero-sub { margin-bottom: 0; max-width: 560px; }

/* ── Sub menu tabs ── */
.tester-tabs {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 0.4rem 0 0.6rem;
}
.tester-tab {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 15px;
  padding: 9px 18px; border-radius: 10px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 2.5px solid var(--ink); box-shadow: var(--hard);
  transition: transform .1s, box-shadow .1s, background .1s;
  white-space: nowrap;
}
.tester-tab .ico { font-size: 17px; line-height: 1; }
.tester-tab:hover { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.tester-tab[aria-selected="true"] {
  background: var(--red); color: #fff;
  transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink);
}
.tester-tab:focus-visible, .t-btn:focus-visible, .gp-slot:focus-visible,
.seg-btn:focus-visible, .mouse-pad:focus-visible {
  outline: 3px solid var(--yellow-deep); outline-offset: 2px;
}

/* ── Panels ── */
section.tester-panel { padding: 2.2rem 0 1rem; }
.tester-panel[hidden] { display: none; }
.tester-panel .section-sub { max-width: 620px; margin-bottom: 1.6rem; }

.t-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.t-grid.two { grid-template-columns: 1.15fr 1fr; align-items: start; }
@media (max-width: 860px) { .t-grid.two { grid-template-columns: 1fr; } }

.t-card {
  background: var(--panel); border: 2.5px solid var(--ink); border-radius: 14px;
  box-shadow: var(--hard); padding: 1.3rem; margin-bottom: 18px; min-width: 0;
}
.t-grid .t-card { margin-bottom: 0; }
.t-card-title {
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 18px;
  color: var(--ink); margin-bottom: 0.8rem; line-height: 1.2; overflow-wrap: anywhere;
}
.t-card-title small { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; font-weight: 500; color: var(--ink-faint); }

.t-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 0.9rem; }
.t-hint { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin-top: 0.8rem; }
.t-notes { margin: 1rem 0 0; padding-left: 1.1rem; font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; }
.t-notes li + li { margin-top: 0.35rem; }

/* buttons */
.t-btn {
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s; white-space: nowrap;
}
.t-btn.primary { background: var(--red); color: #fff; }
.t-btn.big { font-size: 16px; padding: 12px 10px; flex: 1; }
.t-btn.active { background: var(--yellow); }
.t-btn:hover:not(:disabled)  { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.t-btn:active:not(:disabled) { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.t-btn:disabled { opacity: .45; cursor: not-allowed; }

/* fields */
.t-field { display: flex; flex-direction: column; gap: 5px; }
.t-field.grow { flex: 1; min-width: 0; }
.t-field > span, .t-range > span:first-child {
  font-family: 'Spline Sans Mono', monospace; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
}
.t-field input, .t-field select {
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 8px;
  padding: 8px 10px; min-width: 0; width: 100%;
}
.t-field input[type="number"] { width: 110px; }
.t-range { display: block; margin-bottom: 1.1rem; }
.t-range > span:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; }
.t-range b { color: var(--red); }
.t-range input[type="range"] { width: 100%; accent-color: var(--red); }
.t-range-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }
.t-range-ends i { font-style: normal; }
.t-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin-top: 1rem; cursor: pointer; }
.t-check input { accent-color: var(--red); width: 17px; height: 17px; margin-top: 1px; flex-shrink: 0; }

/* status message */
.t-msg {
  margin-top: 0.9rem; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.5;
  background: var(--soft); border: 2px solid var(--line); color: var(--ink-soft);
}
.t-msg.ok  { background: var(--ok-bg);  border-color: var(--ok-edge);  color: var(--ok); }
.t-msg.err { background: var(--err-bg); border-color: var(--err-edge); color: var(--err); }
.t-msg.warn { background: #fff8e1; border-color: var(--yellow-deep); color: #7a5600; }

/* PC / laptop notice */
.pc-notice {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 12px;
  box-shadow: var(--hard); padding: 12px 14px; margin-bottom: 18px;
  font-size: 14px; line-height: 1.5; color: var(--ink);
}
.pc-notice[hidden] { display: none; }
.pc-notice.soft { background: var(--soft); }
.pc-notice-ico { font-size: 22px; line-height: 1.1; }

/* stat tiles */
.t-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 1rem; }
.t-stat {
  border: 2px solid var(--ink); border-radius: 10px; padding: 8px 10px;
  background: var(--paper); display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.t-stat .k, .gp-stick-box .k, .kb-extra .k {
  font-family: 'Spline Sans Mono', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft);
}
.t-stat .v { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 22px; line-height: 1.1; color: var(--ink); }
.t-stat.bad.hit { background: var(--err-bg); border-color: var(--err); }
.t-stat.bad.hit .v { color: var(--err); }
@media (max-width: 520px) { .t-stats { grid-template-columns: 1fr 1fr; } }

/* info list */
.t-info > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 2px dashed var(--line); font-size: 13.5px;
}
.t-info > div:last-child { border-bottom: none; }
.t-info dt { color: var(--ink-soft); }
.t-info dt small { color: var(--ink-faint); }
.t-info dd { font-weight: 700; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.t-info.inline { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.t-info.inline > div { border: none; padding: 0; gap: 6px; }
.t-info.inline dd { font-family: 'Spline Sans Mono', monospace; font-size: 12.5px; }

/* ── Mouse ── */
.mouse-pad {
  position: relative; display: flex; align-items: center; gap: 18px;
  min-height: 230px; padding: 1.2rem; border-radius: 12px; cursor: pointer;
  background: var(--yellow); border: 2.5px solid var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: background .15s;
}
.mouse-pad.dbl { background: var(--red); color: #fff; }
.mouse-svg { width: 120px; flex-shrink: 0; }
.mouse-svg .m-body { fill: var(--panel); stroke: var(--ink); stroke-width: 5; }
.mouse-svg .m-btn  { fill: var(--panel); stroke: var(--ink); stroke-width: 4; transition: fill .12s; }
.mouse-svg .m-btn.on { fill: var(--red); transition: none; }
.mouse-svg .m-btn.seen { fill: var(--ok-edge); }
.mouse-svg .m-btn.seen.on { fill: var(--red); }
.mouse-svg .m-arrow { fill: var(--ink); opacity: .25; transition: opacity .12s; }
.mouse-svg .m-arrow.on { opacity: 1; fill: var(--red); transition: none; }
.mouse-pad-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mouse-pad-text strong { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: clamp(18px, 3vw, 24px); line-height: 1.1; }
.mouse-pad-text span { font-family: 'Spline Sans Mono', monospace; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; opacity: .8; }

.btn-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'Spline Sans Mono', monospace; font-size: 12px; font-weight: 600;
  border: 2px solid var(--ink); border-radius: 999px; padding: 5px 12px;
  background: var(--paper); color: var(--ink-soft);
}
.chip b { color: var(--ink); }
.chip.seen { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.chip.seen b { color: var(--ok); }

.t-log {
  list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper);
  font-family: 'Spline Sans Mono', monospace; font-size: 12.5px;
}
.t-log li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.t-log li:last-child { border-bottom: none; }
.t-log li.empty { color: var(--ink-faint); justify-content: center; }
.t-log li.dbl { background: var(--err-bg); color: var(--err); font-weight: 700; }

/* ── Keyboard ── */
.kb-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.kb-readout { display: flex; gap: 16px; flex-wrap: wrap; font-family: 'Spline Sans Mono', monospace; font-size: 12.5px; color: var(--ink-soft); }
.kb-readout b { color: var(--ink); }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); }
.seg-btn {
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 13px;
  padding: 6px 14px; background: var(--panel); color: var(--ink); border: none; cursor: pointer;
}
.seg-btn + .seg-btn { border-left: 2px solid var(--ink); }
.seg-btn.active { background: var(--ink); color: #fff; }

.kb-scroll { overflow-x: auto; padding-bottom: 6px; }
.kb-media, .kb { min-width: 900px; }
.kb-media { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.kb {
  display: grid; grid-template-columns: repeat(92, 1fr);
  grid-auto-rows: 42px; gap: 5px 0;
}
.key {
  display: flex; align-items: center; justify-content: center; text-align: center;
  margin: 0 2.5px; padding: 0 3px; min-width: 0;
  background: var(--panel); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 7px; box-shadow: 0 3px 0 var(--ink);
  font-family: 'Spline Sans Mono', monospace; font-size: 11px; font-weight: 700; line-height: 1.05;
  white-space: pre-line; overflow: hidden; user-select: none;
  transition: background .1s;
}
.kb-media .key { margin: 0; padding: 0 10px; height: 34px; font-size: 10.5px; }
.kb-media .key.fn { background: var(--ink); color: #fff; }
.key.tested { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); box-shadow: 0 3px 0 var(--ok); }
.kb-media .key.fn.tested { background: var(--ok); color: #fff; }
.key.chatter { background: var(--err-bg); border-color: var(--err); color: var(--err); box-shadow: 0 3px 0 var(--err); }
.key.down, .key.tested.down, .key.chatter.down {
  background: var(--yellow); border-color: var(--ink); color: var(--ink);
  box-shadow: 0 1px 0 var(--ink); transform: translateY(2px); transition: none;
}
.kb-extra { margin-top: 0.9rem; font-size: 13px; }
.kb-extra code {
  font-family: 'Spline Sans Mono', monospace; font-size: 12px;
  background: var(--ok-bg); border: 1.5px solid var(--ok-edge); color: var(--ok);
  border-radius: 6px; padding: 1px 7px; margin: 0 3px 3px 0; display: inline-block;
}

.kb-readout .kb-dbl.hit, .kb-readout .kb-dbl.hit b { color: var(--err); font-weight: 700; }
.kb-chatter { margin-top: 1.3rem; padding-top: 1.1rem; border-top: 2px dashed var(--line); }
.kb-chatter .t-log { margin-top: 0.9rem; max-height: 180px; }

/* ── Webcam ── */
.cam-view {
  position: relative; margin-top: 0.9rem; aspect-ratio: 16 / 9;
  background: var(--ink); border: 2.5px solid var(--ink); border-radius: 10px; overflow: hidden;
}
.cam-view video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--ink); }
.cam-view.mirror video { transform: scaleX(-1); }
.cam-badge {
  position: absolute; left: 8px; top: 8px;
  font-family: 'Spline Sans Mono', monospace; font-size: 11px; font-weight: 700;
  background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 2px 8px;
}
.cam-badge[hidden] { display: none; }
.cam-swatch { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--ink); border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* ── Mic ── */
.mic-canvas {
  display: block; width: 100%; height: 150px; margin-top: 0.9rem;
  background: var(--ink); border: 2.5px solid var(--ink); border-radius: 10px;
}
.meter { height: 16px; margin-top: 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ok) 0 60%, var(--yellow) 80%, var(--red) 100%); background-size: 100vw 100%; transition: width .06s linear; }
.meter-legend { display: flex; justify-content: space-between; margin-top: 6px; font-family: 'Spline Sans Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.meter-legend b { color: var(--ink); }
#micPlayback { width: 100%; margin-top: 0.9rem; }
.t-btn.rec { background: var(--red); color: #fff; }

/* ── Headset ── */
.hs-visual { display: flex; justify-content: center; margin-bottom: 1rem; }
.hs-visual svg { width: min(240px, 70%); }
.hs-band { fill: none; stroke: var(--ink); stroke-width: 10; stroke-linecap: round; }
.hs-cup { fill: var(--panel); stroke: var(--ink); stroke-width: 5; transition: fill .12s; }
.hs-cup.on { fill: var(--red); }
.hs-lbl { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 26px; text-anchor: middle; fill: var(--ink); pointer-events: none; }
.hs-btns { display: flex; gap: 10px; }

/* ── Gamepad ── */
.gp-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.gp-slot {
  font-family: 'Spline Sans Mono', monospace; font-size: 11.5px; font-weight: 700;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left;
  background: var(--paper); color: var(--ink-faint);
  border: 2px solid var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gp-slot.connected { color: var(--ink); background: var(--panel); }
.gp-slot.active { box-shadow: 3px 3px 0 var(--ink); background: var(--yellow); color: var(--ink); }
@media (max-width: 640px) { .gp-slots { grid-template-columns: 1fr 1fr; } }

.gp-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 2.6rem 1rem; }
.gp-empty[hidden] { display: none; }
.gp-empty-ico { font-size: 46px; line-height: 1; }
.gp-empty strong { font-family: 'Baloo 2', cursive; font-size: 19px; }
#gpUnsupported { color: var(--err); font-size: 13.5px; }
#gpUnsupported[hidden] { display: none; }
.gp-help {
  width: 100%; max-width: 620px; margin-top: 1rem; text-align: left;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--soft); padding: 0.7rem 1rem;
}
.gp-help summary {
  cursor: pointer; font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 15px; color: var(--ink);
}
.gp-help ol { margin: 0.7rem 0 0.2rem; padding-left: 1.2rem; font-size: 13px; color: var(--ink-soft); line-height: 1.65; }
.gp-help li + li { margin-top: 0.45rem; }
.gp-help b { color: var(--ink); }
.gp-help code {
  font-family: 'Spline Sans Mono', monospace; font-size: 12px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 5px; padding: 0 5px;
}

.gp-svg { width: 100%; max-width: 440px; display: block; margin: 0 auto; }
.gp-svg .g-body { fill: var(--soft); stroke: var(--ink); stroke-width: 4; }
.gp-svg .g-well { fill: var(--line); stroke: var(--ink); stroke-width: 2.5; }
.gp-svg .g-b { fill: var(--panel); stroke: var(--ink); stroke-width: 3; }
.gp-svg .g-b.on { fill: var(--red); }

.gp-sticks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gp-stick-box { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.gp-stick-box canvas { width: 100%; max-width: 180px; aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); }
.gp-stick-box .v { font-family: 'Spline Sans Mono', monospace; font-size: 11.5px; color: var(--ink); }
.gp-stick-box .v.err { color: var(--red); font-weight: 700; }

.gp-raw { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.gp-raw.axes { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.gp-cell {
  position: relative; overflow: hidden; border: 2px solid var(--ink); border-radius: 8px;
  padding: 6px 8px; background: var(--paper);
  font-family: 'Spline Sans Mono', monospace; font-size: 11px; display: flex; flex-direction: column; gap: 1px;
}
.gp-cell .bar { position: absolute; left: 0; bottom: 0; height: 100%; width: 0; background: var(--yellow); z-index: 0; }
.gp-cell.axis .bar { height: 5px; background: var(--red); }
.gp-cell > span { position: relative; z-index: 1; }
.gp-cell .n { font-weight: 700; color: var(--ink-soft); }
.gp-cell .val { font-weight: 700; color: var(--ink); font-size: 12.5px; }
.gp-cell.pressed { border-color: var(--red); box-shadow: 2px 2px 0 var(--red-deep); }

@media (max-width: 560px) {
  .tester-hero { padding: 2.2rem 0 1.4rem; }
  .tester-tab { font-size: 13.5px; padding: 8px 12px; }
  .t-card { padding: 1rem; }
  .mouse-pad { flex-direction: column; text-align: center; min-height: 0; }
  .mouse-svg { width: 96px; }
  .hs-btns { flex-wrap: wrap; }
}
