/* TSUBUAN'S TINY OFFICE — topdown
   デザイントークンは clock-widget / DAILY QUOTE シリーズと共通:
   面はページと同色(ライト#fff・ダーク#191919)、区切りは線だけ */

:root {
  --stage: #ffffff;              /* Notionライトの背景と同色 */
  --card-border: #e6e5e3;
  --text: #2c2c2b;
  --text-sub: #7d7a75;
  --accent-a: #5e89e6;           /* blue */
  --accent-b: #a198fa;           /* purple */
  --accent-c: #edaefc;           /* pink */
  --toggle-hover: #f1efed;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ダークモード: ボタンで選んだ設定が最優先、「自動」のときはOS設定に追従 */
:root[data-theme="dark"] {
  --stage: #191919;              /* Notionダークの背景と同色 */
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-sub: rgba(255, 255, 255, 0.65);
  --toggle-hover: rgba(255, 255, 255, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage: #191919;
    --card-border: rgba(255, 255, 255, 0.16);
    --text: #ffffff;
    --text-sub: rgba(255, 255, 255, 0.65);
    --toggle-hover: rgba(255, 255, 255, 0.08);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden; /* Notion埋め込みでスクロールバーを出さない */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: var(--stage);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.app { height: 100%; display: flex; flex-direction: column; }

/* ---- 上部バー(面は塗らない・ページに溶け込ませる) ---- */
.topbar {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.topbar .title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  white-space: nowrap;
  margin-right: 4px;
}
.topbar .title .accent {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.moves { display: flex; gap: 6px; }
.moves button {
  font: inherit;
  font-size: 11px;
  padding: 5px 10px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), background 140ms ease,
    border-color 140ms ease, color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .moves button:hover { background: var(--toggle-hover); }
}
.moves button:active { transform: scale(0.96); }
.moves button.on {
  border-color: var(--accent-b);
  color: var(--accent-b);
  background: rgba(161, 152, 250, 0.12);
  font-weight: 600;
}
.themebtn {
  font: inherit;
  font-size: 13px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .themebtn:hover { background: var(--toggle-hover); }
}
.themebtn:active { transform: scale(0.92); }

/* ステータスと説明文は右側(押せない物なのでNotionメニューと重なってもOK) */
.status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-sub);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .status .dot { animation: none; }
}
.desc {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 幅がせまいときは説明文→タイトル→ボタンの文字の順にたたむ */
.moves .ico { display: none; }
@media (max-width: 660px) { .desc { display: none; } }
@media (max-width: 540px) { .topbar .title { display: none; } }
@media (max-width: 430px) {
  .moves .txt { display: none; }
  .moves .ico { display: inline; }
  .moves button { padding: 4px 7px; }
}

/* ---- ステージ ---- */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewport { position: relative; }

#game {
  display: block;
  image-rendering: pixelated;
  cursor: pointer;
}

/* ---- 吹き出し(ゲーム内の物なので白地に濃い文字で固定) ---- */
.bubble {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
.bubble .inner {
  display: block;
  background: #fff;
  color: #2c2c2b;
  border: 1px solid #d2d2cf;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
  position: relative;
  opacity: 0;
  transform: scale(0.95);
  transform-origin: 50% 100%;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.bubble.show .inner { opacity: 1; transform: scale(1); }
.bubble .inner::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px; height: 8px;
  background: #fff;
  border-right: 1px solid #d2d2cf;
  border-bottom: 1px solid #d2d2cf;
  transform: translateX(-50%) rotate(45deg);
}

.credit {
  flex: none;
  padding: 4px 8px 6px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--text-sub);
  text-align: center;
}
