/* game-lab の共通スタイル。ゲームのページ（html.lab-game）とトップページの両方で読む。
   トップページと★メニューは、一般向けの明るい配色。ゲームの中の色は各ゲームが決める。 */

:root {
  --lab-bg: #f6f3ee;        /* 背景（あたたかい白） */
  --lab-panel: #ffffff;     /* カード・シート */
  --lab-panel-2: #f1ede6;   /* ボタンの地 */
  --lab-line: #e4ded4;      /* 枠線 */
  --lab-text: #2a2c38;      /* 文字 */
  --lab-dim: #737686;       /* 補足の文字 */
  --lab-accent: #ff8a3d;    /* 主な色（オレンジ） */
  --lab-accent-text: #ffffff;
  --lab-accent-2: #22a699;  /* NEW など（青緑） */
  --lab-star: #ffb400;      /* ★ */
  --lab-shadow: 0 2px 10px rgba(60, 50, 30, 0.08);
  --lab-radius: 16px;
  --lab-safe-top: env(safe-area-inset-top, 0px);
  --lab-safe-right: env(safe-area-inset-right, 0px);
  --lab-safe-bottom: env(safe-area-inset-bottom, 0px);
  --lab-safe-left: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--lab-bg);
  color: var(--lab-text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ---- ゲームのページ ---- */
html.lab-game, html.lab-game body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: #000;
}

.lab-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

/* 右上の★ボタン（ゲームの上に重なる）。ゲームは右上 56px 四方に大事な表示を置かない */
.lab-fab {
  position: fixed;
  top: calc(var(--lab-safe-top) + 8px);
  right: calc(var(--lab-safe-right) + 8px);
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 20, 30, 0.4);
  color: var(--lab-star);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  touch-action: manipulation;
}
.lab-fab.lab-pulse { animation: lab-pulse 1.2s ease-out 3; }
@keyframes lab-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 180, 0, 0.8); transform: scale(1); }
  30% { transform: scale(1.18); }
  100% { box-shadow: 0 0 0 16px rgba(255, 180, 0, 0); transform: scale(1); }
}

/* ---- メニューと評価（下から出るシート） ---- */
.lab-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 18, 30, 0.45);
  touch-action: manipulation;
  user-select: none;
}
.lab-sheet {
  width: min(100%, 520px);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--lab-panel);
  color: var(--lab-text);
  border-radius: 22px 22px 0 0;
  padding: 14px 16px calc(var(--lab-safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  animation: lab-up 0.18s ease-out;
}
@keyframes lab-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.lab-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lab-title { font-weight: 700; font-size: 18px; }
.lab-ver { font-weight: 400; font-size: 13px; color: var(--lab-dim); }
.lab-close {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--lab-panel-2); color: var(--lab-text); font-size: 22px;
}
.lab-core { color: var(--lab-dim); font-size: 14px; line-height: 1.5; }
.lab-stars { display: flex; justify-content: space-between; gap: 4px; }
.lab-star {
  flex: 1; height: 52px; border: none; border-radius: 12px;
  background: var(--lab-panel-2); color: #d6d0c4; font-size: 30px;
  touch-action: manipulation;
}
.lab-star.on { color: var(--lab-star); }
.lab-rating-label { text-align: center; color: var(--lab-dim); font-size: 14px; min-height: 1.2em; }
.lab-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-tag, .lab-chip {
  min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--lab-line); background: var(--lab-panel); color: var(--lab-text);
  font-size: 14px; text-decoration: none; display: inline-flex; align-items: center;
  touch-action: manipulation;
}
.lab-tag.on { background: var(--lab-accent-2); border-color: var(--lab-accent-2); color: #ffffff; }
.lab-text {
  width: 100%; resize: vertical; border-radius: 12px; border: 1px solid var(--lab-line);
  background: #fbfaf7; color: var(--lab-text); padding: 10px; font: inherit; font-size: 16px;
  user-select: text; -webkit-user-select: text; touch-action: auto;
}
.lab-send {
  height: 48px; border: none; border-radius: 14px;
  background: var(--lab-accent); color: var(--lab-accent-text); font-size: 16px; font-weight: 700;
}
.lab-send:disabled { opacity: 0.4; }
.lab-note { text-align: center; color: var(--lab-dim); font-size: 12px; }
.lab-status { text-align: center; color: var(--lab-accent-2); font-size: 14px; min-height: 1.2em; }
.lab-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 4px; border-top: 1px solid var(--lab-line); }
.lab-row .lab-chip { margin-top: 8px; }
