/* 三節詠唱バトル 用の WebGL テンプレートの見た目 */

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: sans-serif;
  /* スマホでの長押しメニュー・文字選択・ダブルタップでの拡大を防ぐ */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#unity-canvas {
  display: block;
  background: #000;
  outline: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#loading-title {
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 0.1em;
}

#loading-bar {
  width: min(60vw, 480px);
  height: 16px;
  border: 3px solid #fff;
  box-sizing: border-box;
}

#loading-bar-full {
  width: 0;
  height: 100%;
  background: #59ccff;
}

#loading-text {
  font-size: 16px;
}

#message {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
}

.message-warning {
  background: #ffd84d;
  color: #000;
  padding: 8px 12px;
  margin-bottom: 4px;
}

.message-error {
  background: #d33;
  color: #fff;
  padding: 8px 12px;
  margin-bottom: 4px;
}

#fullscreen-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #fff;
  opacity: 0.6;
}

#fullscreen-button:hover {
  opacity: 1;
}

/* 説明ページへのリンク（左下） */
#site-links {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 6;
  display: flex;
  gap: 12px;
  font-size: 12px;
}

#site-links a {
  color: #bbb;
  text-decoration: none;
  opacity: 0.7;
}

#site-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* 対戦中は、誤って押さないようリンクと全画面ボタンを隠す */
body.in-battle #site-links,
body.in-battle #fullscreen-button {
  display: none;
}

#noscript {
  padding: 24px;
  max-width: 720px;
  margin: 0 auto;
}

#noscript a {
  color: #59ccff;
}

/* 文字の入力画面（名前・合言葉など） */
#text-input {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  /* ページ全体で止めている文字の選択・タッチ操作を、入力画面では使えるようにする */
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}

#text-input[hidden] {
  display: none;
}

#text-input-box {
  width: min(90vw, 420px);
  padding: 16px;
  background: #1c2030;
  border: 3px solid #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#text-input-title {
  font-size: 16px;
}

#text-input-field {
  /* 16px より小さいと、iPhone で入力時に画面が拡大されてしまう */
  font-size: 18px;
  padding: 8px;
  border: 2px solid #fff;
  background: #000;
  color: #fff;
  border-radius: 0;
  -webkit-user-select: text;
  user-select: text;
}

#text-input-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#text-input-buttons button {
  font-size: 16px;
  padding: 8px 16px;
  color: #fff;
  background: #33384d;
  border: 2px solid #fff;
}

#text-input-ok {
  background: #2a6f8f !important;
}

/* 広告の枠（位置は index.html の positionAds で決める） */
.ad-slot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  visibility: hidden;
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: auto;
}

.ad-label {
  height: 18px;
  line-height: 18px;
  font-size: 12px;
  color: #bbb;
}

.ad-body {
  overflow: hidden;
}

/* ?adpreview を付けて開いたときの、配置確認用の点線の枠 */
.ad-preview .ad-body {
  outline: 2px dashed #888;
  outline-offset: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 14px;
}

.ad-preview .ad-body::after {
  content: "広告枠 " attr(data-size);
}

/* スマホを縦向きにしているときは横向きにするよう案内する */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 20px;
  text-align: center;
}

#rotate-icon {
  font-size: 64px;
}

@media (orientation: portrait) {
  body.mobile #rotate {
    display: flex;
  }
}
