/* touch.css: phone controls (see touch.js). Everything here is scoped to .tc / .tc-play. */

.tc-safe-probe {
  position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.tc-haptic { position: fixed; left: -100px; top: -100px; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

.tc { display: none; }

/* ---- play mode: the page becomes a full-screen game surface ---- */
html.tc-play, html.tc-play body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
body.tc-play .top, body.tc-play .bar, body.tc-play .help, body.tc-play .hint { display: none !important; }
body.tc-play main { padding: 0; }
body.tc-play .stage.tc-stage {
  position: fixed;
  z-index: 5;
  margin: 0;
  border: 0;
  aspect-ratio: auto;
  touch-action: none;
}
body.tc-play .np:not(.np-over) { display: none; }
body.tc-play .np.np-over { width: min(calc(100% - 16px), 520px); padding: 10px 12px; font-size: 14px; }
body.tc-play .np.np-over .np-codebox b { font-size: 24px; }
body.tc-play .np-link input { font-size: 12px; }

body.tc-play .tc {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}
.tc-zone, .tc-sys, .tc-sheet { pointer-events: auto; touch-action: none; }
.tc-zone { position: absolute; }
.tc-debug .tc-zone { outline: 1px dashed rgba(0, 255, 120, 0.7); background: rgba(0, 255, 120, 0.06); }

/* ---- d-pad ---- */
.tc-dpad { position: absolute; pointer-events: none; opacity: var(--tc-op, 0.6); transition: opacity 0.15s; }
.tc-dpad.tc-active { opacity: calc(var(--tc-op, 0.6) + 0.25); }
.tc-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 60%, rgba(255, 255, 255, 0.0) 72%);
  border: 2px solid rgba(255, 255, 255, 0.22);
}
.tc-arm, .tc-hub { position: absolute; background: rgba(30, 30, 34, 0.85); border: 2px solid rgba(255, 255, 255, 0.45); }
.tc-hub { left: 34%; top: 34%; width: 32%; height: 32%; border: 0; background: rgba(30, 30, 34, 0.85); }
.tc-arm-u { left: 34%; top: 6%; width: 32%; height: 30%; border-bottom: 0; border-radius: 8px 8px 0 0; }
.tc-arm-d { left: 34%; bottom: 6%; width: 32%; height: 30%; border-top: 0; border-radius: 0 0 8px 8px; }
.tc-arm-l { top: 34%; left: 6%; height: 32%; width: 30%; border-right: 0; border-radius: 8px 0 0 8px; }
.tc-arm-r { top: 34%; right: 6%; height: 32%; width: 30%; border-left: 0; border-radius: 0 8px 8px 0; }
.tc-arm::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0; border: 7px solid transparent; transform: translate(-50%, -50%); }
.tc-arm-u::after { border-bottom-color: rgba(255, 255, 255, 0.7); margin-top: -4px; }
.tc-arm-d::after { border-top-color: rgba(255, 255, 255, 0.7); margin-top: 4px; }
.tc-arm-l::after { border-right-color: rgba(255, 255, 255, 0.7); margin-left: -4px; }
.tc-arm-r::after { border-left-color: rgba(255, 255, 255, 0.7); margin-left: 4px; }
.tc-dpad[data-dir*="U"] .tc-arm-u, .tc-dpad[data-dir*="D"] .tc-arm-d,
.tc-dpad[data-dir*="L"] .tc-arm-l, .tc-dpad[data-dir*="R"] .tc-arm-r { background: rgba(224, 178, 58, 0.85); border-color: #ffd36b; }
.tc-thumb {
  position: absolute; left: 50%; top: 50%; width: 34%; height: 34%; margin: -17% 0 0 -17%;
  border-radius: 50%; background: rgba(255, 255, 255, 0.18); border: 2px solid rgba(255, 255, 255, 0.35);
  opacity: 0; transition: opacity 0.1s;
}
.tc-dpad.tc-active .tc-thumb { opacity: 1; }

/* ---- attack buttons ---- */
.tc-btn {
  position: absolute; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(24, 24, 28, 0.78);
  opacity: var(--tc-op, 0.6);
  font-weight: 800; letter-spacing: 0.04em; line-height: 1.05;
  font-size: calc(var(--tc-u, 56px) * 0.2);
  text-shadow: 0 1px 2px #000;
  transition: transform 0.05s, opacity 0.1s;
}
.tc-btn .tc-sub { font-weight: 600; font-size: 0.78em; opacity: 0.85; letter-spacing: 0; }
.tc-punch { border-color: rgba(255, 196, 92, 0.9); }
.tc-punch .tc-lab { color: #ffd38a; }
.tc-kick { border-color: rgba(120, 200, 255, 0.9); }
.tc-kick .tc-lab { color: #a9dcff; }
.tc-block { border-color: rgba(255, 255, 255, 0.75); background: rgba(60, 60, 66, 0.8); }
.tc-btn.tc-on { opacity: 1; transform: scale(0.94); background: rgba(224, 178, 58, 0.9); color: #1a1406; text-shadow: none; }
.tc-btn.tc-on .tc-lab { color: #1a1406; }

/* ---- system buttons ---- */
.tc-sys { position: absolute; display: flex; gap: 6px; }
.tc-sys-r { justify-content: flex-end; }
.tc-sbtn {
  height: 100%; min-width: 100%;
  padding: 0 10px; border-radius: 10px;
  font: 700 15px/1 system-ui, -apple-system, sans-serif; letter-spacing: 0.08em;
  color: #fff; background: rgba(24, 24, 28, 0.7); border: 1.5px solid rgba(255, 255, 255, 0.4);
  opacity: 0.8; touch-action: manipulation;
}
.tc-sbtn.tc-menu { font-size: 20px; letter-spacing: 0; }
.tc-sbtn.tc-start { color: #1a1406; background: rgba(224, 178, 58, 0.85); border-color: #ffd36b; }
.tc-sbtn.tc-on { opacity: 1; transform: scale(0.95); }
.tc-sbtn.tc-compact { padding: 0 3px; font-size: 11px; letter-spacing: 0; }   
.tc-sbtn.tc-menu.tc-compact { font-size: 18px; }

.tc-toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  max-width: min(90vw, 420px); padding: 8px 14px; border-radius: 10px;
  background: rgba(10, 10, 12, 0.85); border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 14px; text-align: center; pointer-events: none;
}
.tc-toast[hidden] { display: none; }

/* ---- menu sheet ---- */
.tc-sheet { position: absolute; z-index: 30; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 12px; overflow-y: auto; }
.tc-sheet[hidden] { display: none; }
.tc-sheet-box {
  width: min(100%, 420px); max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 14px; background: #16161a; border: 1px solid #3a3326;
  color: #e8e6e3; font-size: 15px;
}
.tc-sheet-h { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #e0b23a; text-align: center; }
.tc-sheet-box > button { width: 100%; min-height: 44px; border-radius: 10px; font-size: 16px; color: #e8e6e3; background: #222228; border: 1px solid #3a3a42; }
.tc-sheet-box > button.tc-primary { background: #e0b23a; color: #1a1406; border-color: #e0b23a; font-weight: 700; }
.tc-sheet-box > button.tc-danger { color: #ff8a80; }
.tc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tc-row > span:first-child { color: #b8b2a7; font-size: 14px; }
.tc-seg { display: inline-flex; border: 1px solid #3a3a42; border-radius: 10px; overflow: hidden; }
.tc-seg button { min-height: 38px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 0; background: #222228; color: #e8e6e3; font-size: 14px; }
.tc-seg button + button { border-left: 1px solid #3a3a42; }
.tc-seg button.on { background: #e0b23a; color: #1a1406; font-weight: 700; }
.tc-note { margin: 0; color: #9a958c; font-size: 13px; text-align: center; }
.tc-sheet-open .tc-btn, .tc-sheet-open .tc-dpad { opacity: 0.15; }

/* ---- start page on phones ---- */
html.tc-device .help table, html.tc-device .help .sub-h, html.tc-device .help .tables { display: none; }
html.tc-device .start { touch-action: manipulation; }

/* The start menu lives inside the game box (16:10) on desktop; on a phone that box is too small
   (in landscape the main button ends up scrolled out of sight), so before the game starts the
   box grows with its content and the page scrolls normally. */
html.tc-device body:not(.tc-play) .top { min-height: 0; padding: max(10px, env(safe-area-inset-top)) 16px 6px; }
html.tc-device body:not(.tc-play) .top h1 { font-size: 22px; }
html.tc-device body:not(.tc-play) .top .sub { font-size: 12px; }
html.tc-device body:not(.tc-play) .stage { width: min(100%, 560px); aspect-ratio: auto; overflow: visible; border-radius: 12px; }
html.tc-device body:not(.tc-play) .cover { position: relative; inset: auto; overflow: visible; padding: 18px 14px; border-radius: 12px; }
html.tc-device body:not(.tc-play) .cover[hidden] { display: none; }
html.tc-device body:not(.tc-play) main { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
html.tc-device .menu .start { min-height: 52px; }
html.tc-device .join-row input, html.tc-device .join-row button { min-height: 44px; font-size: 16px; }

/* ---- move buttons ---- */
.tc-assist { position: absolute; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; touch-action: none; }
.tc-assist[hidden] { display: none; }
.tc-pill {
  height: var(--tc-pill-h, 36px); line-height: var(--tc-pill-h, 36px); padding: 0 12px; border-radius: 999px;
  font: 700 13px/var(--tc-pill-h, 36px) system-ui, -apple-system, sans-serif; white-space: nowrap;
  color: #fff; background: rgba(24, 24, 28, 0.78); border: 1.5px solid rgba(224, 178, 58, 0.9);
  opacity: calc(var(--tc-op, 0.6) + 0.2);
}
.tc-pill.tc-fatal { border-color: #ff5a4f; color: #ffd2cf; animation: tc-pulse 0.9s ease-in-out infinite alternate; }
.tc-pill.tc-on { background: rgba(224, 178, 58, 0.95); color: #1a1406; opacity: 1; }
@keyframes tc-pulse { from { box-shadow: 0 0 0 0 rgba(255, 90, 79, 0.0); } to { box-shadow: 0 0 12px 2px rgba(255, 90, 79, 0.7); } }
.tc-padmode .tc-dpad, .tc-padmode .tc-btn { display: none; }
.tc-moves .tc-mv-h { margin-top: 6px; font-weight: 800; color: #e0b23a; }
.tc-mv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid #2a2a31; font-size: 14px; }
.tc-mv small { color: #9a958c; }
.tc-mv b { white-space: nowrap; font-weight: 700; color: #fff; }

.tc-sheet-open .tc-assist { visibility: hidden; }
.tc-cols { display: flex; flex-direction: column; gap: 8px; }
.tc-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tc-col > button { width: 100%; min-height: 44px; border-radius: 10px; font-size: 16px; color: #e8e6e3; background: #222228; border: 1px solid #3a3a42; }
.tc-col > button.tc-primary { background: #e0b23a; color: #1a1406; border-color: #e0b23a; font-weight: 700; }
.tc-col > button.tc-danger { color: #ff8a80; }
.tc-land .tc-menu-box { width: min(100%, 780px); }
.tc-land .tc-cols { flex-direction: row; gap: 14px; }
.tc-land .tc-col { flex: 1 1 0; }
.tc-land .tc-sheet-box { padding: 10px 14px; gap: 6px; }
.tc-land .tc-col > button { min-height: 40px; }
.tc-land .tc-seg button { min-height: 34px; }
.tc-moves { width: min(100%, 520px); }
html.tc-device .help .fine:not(.kb-note) { display: none; }
.tc-load {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  max-width: min(90vw, 460px); padding: 10px 16px; border-radius: 10px;
  background: rgba(10, 10, 12, 0.85); border: 1px solid rgba(224, 178, 58, 0.5); color: #e8e6e3;
  font-size: 15px; text-align: center; pointer-events: none;
}
.tc-load[hidden] { display: none; }
html.tc-device body:not(.tc-play) .bar { display: flex; }
html.tc-device body:not(.tc-play) .bar .actions { display: none; }

/* ---- keyboard layouts (computer): picker and key pictures. Colours follow the phone buttons:
   punches gold, block grey, kicks blue. ---- */

.mkk-line { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mkk-desc { display: block; margin-top: 4px; }
.mkk-change, .mkk-barbtn {
  font: inherit; color: #e0b23a; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.mkk-change:hover { color: #ffd36b; }
.mkk-barbtn {
  text-decoration: none; padding: 6px 12px; border: 1px solid #3a3a42; border-radius: 8px;
  color: #e8e6e3; background: #18181c; white-space: nowrap;
}
.mkk-barbtn:hover { border-color: #e0b23a; }

.mkk-pop {
  position: absolute; z-index: 60; width: min(460px, calc(100vw - 16px)); box-sizing: border-box;
  padding: 14px 16px 12px; border: 1px solid #3a3a42; border-radius: 12px;
  background: #121216; color: #e8e6e3; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.mkk-pop[hidden] { display: none; }
.mkk-pop-h { font-weight: 700; color: #e0b23a; margin-bottom: 8px; }
.mkk-pop .mkk-desc, .mkk-help .mkk-desc { margin: 10px 0 0; color: #c9c5bd; }
.mkk-fine { margin: 8px 0 0; color: #9a958c; font-size: 13px; }
.mkk-pop kbd, .mkk-help kbd, .mkk-desc kbd {
  display: inline-block; min-width: 1.4em; padding: 0 5px; margin: 0 1px; border: 1px solid #4a4a52; border-bottom-width: 2px;
  border-radius: 5px; background: #222228; color: #f2efe8; font: 700 12px/1.6 ui-monospace, Menlo, Consolas, monospace; text-align: center;
}

.mkk-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.mkk-pick button {
  flex: 1 1 auto; min-height: 36px; padding: 6px 10px; border: 1px solid #3a3a42; border-radius: 8px;
  background: #1c1c22; color: #e8e6e3; font: 600 13px/1.25 system-ui, -apple-system, sans-serif; cursor: pointer;
}
.mkk-pick button:hover { border-color: #8a7440; }
.mkk-pick button.on { background: #e0b23a; border-color: #e0b23a; color: #1a1406; }

/* key pictures */
.mkk-pic { display: flex; align-items: flex-end; justify-content: center; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.mkk-panel { display: grid; grid-template-columns: repeat(3, 54px); gap: 6px; }
.mkk-move { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: 42px 42px; gap: 4px; }
.mkk-move .mkk-cap:first-child { grid-column: 2; }
.mkk-move .mkk-cap:nth-child(2) { grid-column: 1; grid-row: 2; }
.mkk-move .mkk-cap:nth-child(3) { grid-column: 2; grid-row: 2; }
.mkk-move .mkk-cap:nth-child(4) { grid-column: 3; grid-row: 2; }
.mkk-cap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: 50px; border: 1.5px solid #4a4a52; border-bottom-width: 3px; border-radius: 8px; background: #1e1e24;
}
.mkk-move .mkk-cap { height: auto; }
.mkk-cap b { font: 700 16px/1 ui-monospace, Menlo, Consolas, monospace; color: #f2efe8; }
.mkk-cap i { font: 600 10px/1.1 system-ui, -apple-system, sans-serif; font-style: normal; color: #b8b2a7; text-align: center; }
.mkk-cap.mkk-p { border-color: #c79a35; }
.mkk-cap.mkk-p i { color: #e0b23a; }
.mkk-cap.mkk-k { border-color: #4f7fa8; }
.mkk-cap.mkk-k i { color: #8fbbe0; }
.mkk-cap.mkk-b { border-color: #8a8a92; }
.mkk-cap.mkk-dir b { color: #e8e6e3; }
.mkk-grid .mkk-cap.mkk-dir { border-color: #4a4a52; }

.mkk-help { max-width: 520px; }

/* CPU difficulty: a row under the big buttons of the start page, and in the keys popover */
.mkd-row { display: flex; align-items: center; justify-content: center; gap: 6px 10px; flex-wrap: wrap; }
.mkd-row[hidden] { display: none; }
.mkd-lab { color: #b8b2a7; font: 700 12px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase; letter-spacing: 0.08em; }
.mkd-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mkd-pick button {
  min-height: 34px; padding: 5px 11px; border: 1px solid #3a3a42; border-radius: 8px;
  background: rgba(20, 20, 24, 0.85); color: #e8e6e3; font: 600 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer;
}
.mkd-pick button:hover { border-color: #8a7440; }
.mkd-pick button.on { background: #e0b23a; border-color: #e0b23a; color: #1a1406; }
.mkk-pop .mkd-h { margin: 14px 0 8px; }
.mkk-pop .mkd-pick { justify-content: flex-start; }
.tc-select { min-height: 38px; padding: 0 8px; border: 1px solid #3a3a42; border-radius: 10px; background: #222228; color: #e8e6e3; font-size: 14px; }
.mkk-pop .mkd-pick button { padding: 5px 8px; font-size: 12px; }
.mkk-help .mkk-lead { margin: 0 0 10px; }
.mkk-two { display: flex; flex-wrap: wrap; gap: 18px 40px; margin: 6px 0 4px; }
.mkk-two > div { min-width: 0; }
.mkk-two .mkk-pic { justify-content: flex-start; margin-top: 6px; }
.mkk-two-h { font-weight: 700; color: #e0b23a; }
.mkk-two .mkk-fine { max-width: 260px; }
.mkk-pop-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mkk-pop-top .mkk-pop-h { margin: 0; }
.mkk-x {
  width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid #3a3a42; border-radius: 8px;
  background: #1c1c22; color: #e8e6e3; font: 400 22px/1 system-ui, -apple-system, sans-serif; cursor: pointer;
}
.mkk-x:hover { border-color: #e0b23a; color: #ffd36b; }
