/* アイスブレイク横丁 — 全ゲーム共通の土台と部品。
   色はゲーム側の :root で --ib-* を決める(ここは形だけ)。
   グラデーション・ぼかし・ガラス表現は使わない。太いフチ+押すとへこむボタン。 */
:root {
  --ib-font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  --ib-line: 3px;
  --ib-r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior-y: none; }
[hidden] { display: none !important; }
body {
  font-family: var(--ib-font);
  font-weight: 700;
  color: var(--ib-ink);
  /* PCではスマホ幅の画面の左右を、ゲームの背景色で埋める */
  background: var(--ib-bg);
  background-image: var(--ib-bg-image, none);
  background-size: var(--ib-bg-size, auto);
  display: flex;
  justify-content: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-user-select: none;
  user-select: none;
}
input { user-select: text; -webkit-user-select: text; font-family: inherit; }
button { font-family: inherit; color: inherit; cursor: pointer; }

#app { width: 100%; max-width: 448px; min-height: 100dvh; position: relative; overflow: hidden; }

.screen {
  display: none;
  position: absolute;
  inset: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
}
.screen.active { display: flex; animation: ib-fade .25s ease; }
@keyframes ib-fade { from { opacity: 0; } to { opacity: 1; } }

/* ===== Buttons ===== */
.ib-btn {
  display: block; width: 100%;
  min-height: 54px; padding: 10px 16px;
  border: var(--ib-line) solid var(--ib-ink);
  border-radius: var(--ib-btn-r, var(--ib-r));
  font-size: 17px; font-weight: 900; letter-spacing: .04em;
  box-shadow: 0 5px 0 var(--ib-ink);
  transition: transform .06s, box-shadow .06s;
}
.ib-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ib-ink); }
.ib-btn:disabled { opacity: .45; cursor: default; }
.ib-btn-primary { background: var(--ib-primary); color: var(--ib-primary-ink); }
.ib-btn-light { background: var(--ib-light); color: var(--ib-ink); }
.ib-btn-small { min-height: 44px; font-size: 14px; box-shadow: 0 4px 0 var(--ib-ink); }
.ib-btn.is-on { background: var(--ib-light); color: var(--ib-ink); }
.ib-link { background: none; border: none; color: var(--ib-text); font-size: 14px; text-decoration: underline; text-underline-offset: 4px; padding: 8px; align-self: center; }

/* ===== Waiting room ===== */
.ib-content { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 22px; }
.ib-plate { align-self: center; text-align: center; background: var(--ib-paper); border: var(--ib-line) solid var(--ib-ink); border-radius: var(--ib-r); box-shadow: 0 5px 0 var(--ib-ink); padding: 8px 22px 10px; margin-top: 4px; }
.ib-plate-label { font-family: "Dela Gothic One", var(--ib-font); font-weight: 400; font-size: 12px; letter-spacing: .3em; color: var(--ib-accent); }
.ib-code { font-family: "Dela Gothic One", var(--ib-font); font-weight: 400; font-size: 38px; letter-spacing: .14em; margin-right: -.14em; line-height: 1.15; }
.ib-plate-hint { font-size: 11px; color: var(--ib-muted); margin-top: 2px; }
.ib-section { color: var(--ib-text); font-size: 13px; letter-spacing: .08em; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ib-section::after { content: ""; flex: 1; height: 2px; background: currentColor; opacity: .3; }
.ib-members { display: flex; flex-direction: column; gap: 8px; }
.ib-member { display: flex; align-items: center; gap: 8px; background: var(--ib-paper); border: 2.5px solid var(--ib-ink); border-radius: 12px; padding: 7px 10px; min-height: 48px; }
.ib-member-name { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-member-name small { font-size: 11px; color: var(--ib-muted); margin-left: 4px; }
.ib-member-empty { justify-content: center; background: transparent; border-style: dashed; border-color: var(--ib-text); color: var(--ib-text); opacity: .6; font-size: 13px; }
.ib-avatar { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; border: 2.5px solid var(--ib-ink); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; color: var(--ib-ink); }
.ib-tag { flex-shrink: 0; font-size: 10px; border: 2px solid var(--ib-ink); border-radius: 999px; padding: 1px 7px; }
.ib-tag-host { background: var(--ib-ink); color: var(--ib-paper); }
.ib-tag-ready { background: var(--ib-primary); color: var(--ib-primary-ink); }
.ib-tag-wait { background: transparent; color: var(--ib-muted); border-color: var(--ib-muted); }
.ib-kick { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ib-ink); background: var(--ib-light); font-size: 15px; line-height: 1; }
.ib-setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--ib-paper); border: 2.5px solid var(--ib-ink); border-radius: 12px; padding: 8px 10px; }
.ib-setting-label { font-size: 14px; }
.ib-seg { display: flex; border: 2.5px solid var(--ib-ink); border-radius: 10px; overflow: hidden; }
.ib-seg button { border: 0; border-left: 2px solid var(--ib-ink); background: var(--ib-light); padding: 6px 12px; font-size: 13px; font-weight: 900; }
.ib-seg button:first-child { border-left: 0; }
.ib-seg button.on { background: var(--ib-primary); color: var(--ib-primary-ink); }
.ib-seg button:disabled { cursor: default; }
.ib-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.ib-hint { color: var(--ib-text); font-size: 12px; text-align: center; }
.ib-row { display: flex; gap: 10px; }

/* ===== Modals ===== */
.ib-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 18px; }
.ib-modal { position: relative; width: 100%; max-width: 360px; max-height: calc(100dvh - 36px); overflow-y: auto; background: var(--ib-paper); color: var(--ib-ink); border: var(--ib-line) solid var(--ib-ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ib-ink); padding: 22px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ib-modal-title { font-size: 18px; font-weight: 900; text-align: center; }
.ib-close { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; background: none; font-size: 24px; line-height: 1; }
.ib-label { font-size: 12px; color: var(--ib-muted); margin-bottom: -6px; }
.ib-input { width: 100%; font-size: 18px; font-weight: 700; padding: 10px 12px; border: var(--ib-line) solid var(--ib-ink); border-radius: 12px; background: #fff; color: var(--ib-ink); }
.ib-input-code { font-family: "Dela Gothic One", var(--ib-font); font-weight: 400; font-size: 24px; letter-spacing: .3em; text-align: center; }
.ib-error { color: #C8302A; font-size: 13px; min-height: 1em; text-align: center; }
.ib-error:empty { display: none; }
.ib-hint-dark { font-size: 13px; text-align: center; color: var(--ib-muted); }
.ib-qr { background: #fff; border: 2.5px solid var(--ib-ink); border-radius: 10px; padding: 0; align-self: center; width: 240px; }
.ib-qr svg { display: block; width: 100%; height: auto; }

/* 遊び方: 1ページ1ステップ */
.ib-step-no { align-self: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ib-ink); color: var(--ib-paper); display: flex; align-items: center; justify-content: center; font-family: "Dela Gothic One", var(--ib-font); font-weight: 400; font-size: 16px; }
.ib-step-title { text-align: center; font-size: 17px; font-weight: 900; margin-top: -4px; }
.ib-step-art { display: flex; justify-content: center; }
.ib-step-art:empty { display: none; }
.ib-step-body { font-size: 14px; line-height: 1.75; text-align: center; font-weight: 700; }
.ib-dots { display: flex; justify-content: center; gap: 6px; }
.ib-dots i { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ib-ink); }
.ib-dots i.on { background: var(--ib-ink); }

/* ===== Toast / reconnect ===== */
.ib-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ib-ink); color: var(--ib-paper); border-radius: 999px; padding: 10px 18px; font-size: 13px; max-width: calc(100% - 32px); text-align: center; }
.ib-reconnect { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--ib-ink); color: var(--ib-paper); font-size: 12px; text-align: center; padding: 8px; }
