/* 炸弹擂台的样式。中文入口 index.html 和英文入口（/fable-52-effort-levels/arena/index.html）共用这一份 */
  :root { --paper: #f3efe6; --white: #fffdf8; --ink: #111111; --lime: #c8f03c; --muted: #6b665d; --coral: #ff6a55; }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
  body { background-image: radial-gradient(rgba(17,17,17,.10) 1.2px, transparent 1.3px); background-size: 22px 22px; }
  #app { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(250px, 300px) 1fr; grid-template-rows: 1fr; gap: 18px; padding: 18px 22px 18px 96px; }
  #side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-top: 4px; }
  #stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
  canvas#board { display: block; border-radius: 10px; box-shadow: 10px 10px 0 var(--ink); background: var(--ink); }
  canvas#board3d { position: absolute; inset: 0; width: 100%; height: 100%; display: none; opacity: 0; transition: opacity .5s ease-out; }
  body.gl canvas#board3d { display: block; }
  body.gl canvas#board { display: none; }
  body.gl.glon canvas#board3d { opacity: 1; }
  #fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
  .lbl { position: absolute; left: 0; top: 0; will-change: transform, opacity; white-space: nowrap; font-weight: 900; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 10px; padding: 1px 9px; font-size: 15px; line-height: 1.35; display: flex; align-items: center; gap: 3px; }
  .lbl.out { background: var(--coral); box-shadow: 3px 3px 0 var(--ink); font-size: 16px; }
  .lbl.plus { background: var(--white); border-radius: 999px; padding: 0 9px 0 3px; font-family: "Archivo", system-ui, sans-serif; }
  .lbl.plus svg { width: 20px; height: 20px; }
  .lbl.you { background: var(--lime); padding: 0 8px; font-size: 13px; border-width: 2px; border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); }
  .lbl.you::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
  #count { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 4; pointer-events: none; white-space: nowrap; font: 900 96px/1 "Archivo", "Noto Sans SC", system-ui, sans-serif; color: var(--ink); -webkit-text-stroke: 0; text-shadow: 5px 5px 0 var(--lime); display: none; }
  #count.on { display: block; animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; }
  #count.go { color: var(--ink); background: var(--lime); border: 5px solid var(--ink); border-radius: 18px; padding: 4px 26px 10px; font-size: 64px; text-shadow: none; box-shadow: 7px 7px 0 var(--ink); }
  @keyframes pop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 60% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
  #banner { position: absolute; left: 50%; top: 14%; transform: translate(-50%, 0); z-index: 4; pointer-events: none; background: var(--coral); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 6px 6px 0 var(--ink); font-weight: 900; font-size: 26px; padding: 4px 20px; display: none; white-space: nowrap; }
  #banner.on { display: block; animation: ban 2.2s ease-out both; }
  @keyframes ban { 0% { transform: translate(-50%, -30px) scale(.6); opacity: 0; } 12% { transform: translate(-50%, 0) scale(1.08); opacity: 1; } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 0) scale(1); } }
  .top { display: flex; align-items: baseline; gap: 10px; }
  .tick { font: 900 34px/1 "Archivo", system-ui, sans-serif; font-variant-numeric: tabular-nums; min-width: 1.9em; }
  .sd { margin-left: auto; font-weight: 800; font-size: 15px; border: 3px solid var(--ink); border-radius: 9px; padding: 2px 9px; background: var(--white); white-space: nowrap; }
  .sd.on { background: var(--coral); }
  .p { display: flex; align-items: center; gap: 10px; border: 3px solid var(--ink); border-radius: 13px; background: var(--white); padding: 7px 12px; box-shadow: 4px 4px 0 var(--ink); transition: background .3s, box-shadow .3s, transform .3s; }
  .p.dead { background: #e4dfd3; box-shadow: none; color: #8a857a; }
  .p.dead svg.av { opacity: .45; }
  .p.dead .nm { text-decoration: line-through; text-decoration-thickness: 3px; }
  .p.hit { animation: shake .45s ease-out; }
  @keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-5px) rotate(-1deg); } 45% { transform: translateX(5px) rotate(1deg); } 70% { transform: translateX(-3px); } }
  .p .nm { font: 900 19px/1.1 "Archivo", system-ui, sans-serif; letter-spacing: -.2px; }
  .p .who { font-size: 12px; font-weight: 700; color: var(--muted); }
  .p .st { margin-left: auto; font: 800 16px/1 "Archivo", system-ui, sans-serif; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
  .p .st span { display: flex; align-items: center; gap: 2px; }
  .p .st span svg { width: 20px; height: 20px; }
  .p .st small { font-family: inherit; font-size: 13px; font-weight: 700; }
  .p.me { outline: 3px solid var(--lime); outline-offset: 2px; }
  .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
  button { font: inherit; font-weight: 800; font-size: 15px; color: var(--ink); background: var(--white); border: 3px solid var(--ink); border-radius: 11px; padding: 7px 13px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; }
  button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
  button.primary { background: var(--lime); }
  .hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
  kbd { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; border: 2px solid var(--ink); border-radius: 5px; padding: 0 5px; background: var(--white); }
  #muteBtn { position: fixed; z-index: 30; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); width: 40px; height: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 2px 2px 0 var(--ink); border-width: 2.5px; }
  #muteBtn svg { width: 22px; height: 22px; }
  #menuMini { display: none; white-space: nowrap; }
  /* 弹层：盖住整页 */
  #overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(243,239,230,.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); padding: 70px 14px 14px; }
  #overlay.hide { display: none; }
  #overlay.soft { background: rgba(243,239,230,.35); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--white); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--ink); padding: 20px 22px; touch-action: pan-y; animation: cardIn .35s cubic-bezier(.2,1.4,.4,1) both; }
  @keyframes cardIn { from { transform: translateY(18px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
  .card h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.2; }
  .card h2 { margin: 14px 0 8px; font-size: 16px; }
  .card p { margin: 6px 0; font-size: 15px; line-height: 1.55; }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; font: 900 15px/1 "Archivo", system-ui, sans-serif; }
  .chip svg { width: 26px; height: 26px; }
  .chip.off { opacity: .4; box-shadow: none; }
  .seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 11px; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); }
  .seg button { border: 0; border-radius: 0; box-shadow: none; padding: 6px 12px; }
  .seg button.on { background: var(--ink); color: var(--lime); }
  .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
  .big { font-size: 18px; padding: 10px 18px; }
  .res { font-size: 34px; font-weight: 900; margin: 2px 0 8px; display: flex; align-items: center; gap: 12px; }
  .res svg { width: 64px; height: 64px; flex: none; }
  .rank { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 2px; }
  .rank span { display: flex; align-items: center; gap: 4px; font: 800 15px/1.2 "Archivo", "Noto Sans SC", system-ui, sans-serif; }
  .rank svg { width: 26px; height: 26px; }
  /* 手机竖屏：上面一条状态，中间棋盘，下面方向键和炸弹键 */
  #pad { display: none; }
  @media (max-width: 760px) {
    #app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; padding: 10px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    #side { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-top: 0; }
    .top { grid-column: 1 / -1; padding-left: 60px; padding-right: 48px; min-height: 40px; align-items: center; }
    .tick { font-size: 24px; }
    #menuMini { display: inline-block; font-size: 13px; padding: 3px 9px; border-width: 2.5px; box-shadow: 2px 2px 0 var(--ink); }
    .p { flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; box-shadow: 2px 2px 0 var(--ink); border-width: 2.5px; border-radius: 10px; min-width: 0; }
    .p > div { text-align: center; }
    .p .nm { font-size: 12px; }
    .p .who { display: none; }
    .p .st { margin-left: 0; font-size: 12px; gap: 3px; }
    .p .st span svg { width: 14px; height: 14px; }
    .p .st small { font-size: 11px; }
    .p svg.av { width: 28px; height: 28px; }
    .btns, .hint { display: none; }
    #pad { display: flex; position: relative; align-items: stretch; justify-content: space-between; gap: 10px; height: clamp(150px, 24vh, 198px); }
    /* 「下」键中心离框底至少 72px：iPhone Safari 底边一条归系统手势 */
    #app { padding-bottom: max(52px, calc(env(safe-area-inset-bottom) + 24px)); }
    #count { font-size: 72px; }
    #count.go { font-size: 46px; }
    #banner { font-size: 19px; }
  }
  /* 方向键：十字排开的四个键，按住一直走，拇指滑到旁边的键就换方向 */
  #dpad { position: relative; height: 100%; aspect-ratio: 1; flex: none; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 3px; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  #dpad::before { content: ""; grid-area: 2 / 2; margin: 18%; border-radius: 50%; background: rgba(17,17,17,.12); }
  #dpad button { padding: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
  #dpad button svg { width: 46%; height: 46%; pointer-events: none; }
  #dpad button.on { background: var(--lime); transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
  #dpad [data-dir="U"] { grid-area: 1 / 2; } #dpad [data-dir="L"] { grid-area: 2 / 1; } #dpad [data-dir="R"] { grid-area: 2 / 3; } #dpad [data-dir="D"] { grid-area: 3 / 2; }
  #bombBtn { flex: 0 1 38%; max-width: 168px; border-radius: 24px; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; font-size: 20px; background: var(--coral); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; touch-action: none; }
  #bombBtn svg { width: 44px; height: 44px; }
  #bombBtn.press { transform: translate(2px, 2px) scale(.97); box-shadow: 1px 1px 0 var(--ink); }
  /* 矮屏（手机横着拿）：菜单卡放宽、排紧，「开打」不用滚就看得到 */
  @media (orientation: landscape) and (max-height: 540px) {
    #overlay { padding: 8px 14px; }
    .card { width: min(780px, 100%); padding: 12px 18px; }
    .card h1 { font-size: 22px; margin: 0; }
    .card h2 { margin: 8px 0 6px; font-size: 14px; }
    .card p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
    .card .how { margin-top: 6px !important; font-size: 12px !important; }
    .row { margin-top: 8px; }
    .res { font-size: 26px; margin: 0 0 4px; }
  }
  /* 手机横屏：左边方向键，中间棋盘，右边选手和炸弹键 */
  @media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
    #app { grid-template-columns: 27vw minmax(0, 1fr) 24vw; grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "stick stage side" "stick stage bomb"; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
    #side { grid-area: side; display: flex; flex-direction: column; gap: 3px; padding-top: 44px; overflow: hidden; }
    .top { grid-column: auto; padding: 0; min-height: 0; flex: none; gap: 4px 6px; flex-wrap: wrap; }
    .tick { font-size: 20px; min-width: 0; }
    .sd { font-size: 12px; padding: 1px 6px; border-width: 2px; }
    /* 「换对手」挨着右上角的静音键（侧栏太窄放不下一排；左上角留给网站实验室外壳的返回键）；菜单弹层盖在它上面 */
    #menuMini { display: inline-block; position: fixed; z-index: 19; top: calc(max(10px, env(safe-area-inset-top)) + 2px); right: calc(max(10px, env(safe-area-inset-right)) + 48px); font-size: 13px; padding: 7px 12px; border-width: 2.5px; box-shadow: 2px 2px 0 var(--ink); }
    .p { flex-direction: row; gap: 6px; padding: 1px 6px; border-width: 2px; border-radius: 9px; box-shadow: 2px 2px 0 var(--ink); }
    .p svg.av { width: 22px; height: 22px; }
    .p .nm { font-size: 12px; }
    .p .who, .btns, .hint { display: none; }
    .p .st { margin-left: auto; font-size: 12px; gap: 4px; }
    .p .st span svg { width: 13px; height: 13px; }
    .p .st small { font-size: 10px; }
    #stage { grid-area: stage; height: auto; }
    #pad { display: contents; }
    #dpad { grid-area: stick; align-self: center; justify-self: center; width: min(100%, 64vh, 230px); height: auto; margin-top: 8vh; }
    #bombBtn { grid-area: bomb; width: auto; max-width: none; height: min(30vh, 110px); font-size: 17px; }
    #bombBtn svg { width: 34px; height: 34px; }
    #count { font-size: 64px; }
    #count.go { font-size: 40px; }
    #banner { font-size: 18px; }
  }
