/* =========================================================================
   NIRAMEKKO Web版
   パネルは 1280×800（Swift の ContentView と同じ座標）。画面の縦・横の狭い方に合わせて拡大縮小する
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #939393;              /* 余白は Swift と同じグレー（147,147,147） */
  overscroll-behavior: none;
}
body {
  font-family: "Futura", "futura-pt", "Noto Sans JP", sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.nk-back {
  position: fixed; z-index: 5; left: max(12px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top));
  padding: 4px 10px; border-radius: 2px; background: rgb(0 0 0 / .55);
  color: #fff; font-size: 13px; letter-spacing: .04em; text-decoration: none;
}
.nk-back:hover { opacity: 1; text-decoration: underline; }

.nk-viewport { position: fixed; inset: 0; overflow: hidden; }
.nk-stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 800px;
  transform-origin: 0 0;           /* 位置と倍率は app.js が --s で決める */
  transform: translate(calc(-640px * var(--s, 1)), calc(-400px * var(--s, 1))) scale(var(--s, 1));
}

/* パネル上の部品：中心座標 (x, y) と大きさ (w, h) で置く（app.js が style を入れる） */
.nk-el { position: absolute; }
.nk-el > img { display: block; width: 100%; height: 100%; pointer-events: none; }

/* 17 モニター（カメラ） */
.nk-cam { border-radius: 40px; overflow: hidden; background: #000; }
.nk-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.nk-cam__msg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0 40px;
  text-align: center; font-size: 15px; line-height: 1.7; color: #ddf0f5;
}
.nk-cam__msg:empty { display: none; }

/* 1〜3 波形ボタン：選択中は押し込んだ見た目 */
.nk-wave { transition: transform .08s ease-out, filter .08s ease-out; }
.nk-wave.is-on { transform: scale(.93); filter: brightness(.9); }
.nk-hit {
  position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nk-hit:focus-visible { outline: 2px solid #ddf0f5; outline-offset: 2px; border-radius: 8px; }

/* 5〜9 割り当てモニター */
.nk-slot { display: grid; place-items: center; cursor: pointer; }
.nk-slot img { pointer-events: none; }

/* 10〜16 つまみ／18〜22 フェーダー */
.nk-knob, .nk-fader { cursor: grab; touch-action: none; }
.nk-knob:active, .nk-fader:active { cursor: grabbing; }
.nk-knob img, .nk-fader img { pointer-events: none; }

/* 25 数値マス */
.nk-value { cursor: pointer; }
.nk-value span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: "Futura", "futura-pt", sans-serif; font-weight: 500; font-size: 24px; color: #fff;
}

/* 範囲の設定（数値マスの吹き出し） */
.nk-range {
  position: absolute; z-index: 20; width: 280px; padding: 14px;
  background: #f2f2f2; color: #111; border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .35);
  font-family: "Futura", "futura-pt", "Noto Sans JP", sans-serif; font-size: 14px;
}
.nk-range[hidden] { display: none; }
.nk-range__title { margin: 0 0 10px; font-size: 15px; font-weight: 500; }
.nk-range__row { display: grid; grid-template-columns: 36px 52px 1fr; align-items: center; gap: 8px; margin-top: 8px; }
.nk-range input[type=number] { width: 52px; padding: 3px 4px; border: 1px solid #aaa; border-radius: 5px; font: inherit; text-align: right; }
.nk-range input[type=range] { width: 100%; }
.nk-range__foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.nk-range__reset { padding: 4px 10px; border: 1px solid #888; border-radius: 6px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }

/* デバッグ（?debug=1）：生の値 */
.nk-debug {
  position: fixed; z-index: 30; right: 8px; bottom: 8px; margin: 0; padding: 8px 10px;
  background: rgb(0 0 0 / .75); color: #3f3; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre;
  pointer-events: none;
}

/* はじめる */
.nk-start {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px;
  background: rgb(20 20 20 / .82);
}
.nk-start[hidden] { display: none; }
.nk-start__box { max-width: 520px; text-align: center; }
.nk-start__title { margin: 0; font-size: 44px; font-weight: 500; letter-spacing: .06em; }
.nk-start__title span { font-size: 20px; }
.nk-start__lead { margin: 10px 0 0; font-family: "Noto Sans JP", sans-serif; font-size: 15px; }
.nk-start__btn {
  margin-top: 28px; width: 200px; height: 52px; border: 0; border-radius: 2px;
  background: #ff1e00; color: #fff; font: 500 22px/1 "Futura", "futura-pt", sans-serif; letter-spacing: .08em; cursor: pointer;
}
.nk-start__btn:disabled { opacity: .5; cursor: progress; }
.nk-start__note { margin: 20px 0 0; font-family: "Noto Sans JP", sans-serif; font-size: 12px; line-height: 1.8; color: #ccc; }
.nk-start__status { min-height: 1.6em; margin: 14px 0 0; font-family: "Noto Sans JP", sans-serif; font-size: 13px; color: #ffcf9e; }

/* iPhone を縦に持っているとき */
.nk-rotate {
  position: fixed; inset: 0; z-index: 50; display: none; place-items: center;
  background: #939393; font-family: "Noto Sans JP", sans-serif; font-size: 18px;
}
@media (orientation: portrait) and (pointer: coarse) {
  .nk-rotate { display: grid; }
}
