/* 遊び場の ユーザー きりかえ。アプリの いろに あわせるときは :root で --pu-* を かえる */
.pu-chip, .pu-sheet {
  --_ink: var(--pu-ink, #24304A);
  --_soft: var(--pu-soft, #56627C);
  --_card: var(--pu-card, #FFFFFF);
  --_bg: var(--pu-bg, #FFF7E8);
  --_line: var(--pu-line, #D3DCE8);
  --_accent: var(--pu-accent, #E23B47);
  --_hl: var(--pu-hl, #FFF3C4);
  --_focus: var(--pu-focus, #2F7FF0);
}

/* アプリの button の スタイルを うちけす。:where で つよさを クラス 1つぶんに して、あとの ぶひんごとの していが かつように する */
.pu-sheet :where(button) { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.pu-chip:focus-visible, .pu-sheet button:focus-visible { outline: 3px solid var(--_focus); outline-offset: 3px; }
.pu-sheet[hidden] { display: none !important; }
html.pu-lock { overflow: hidden; }

/* ユーザーの アイコン。ひとごとの いろの まるに のせて みわけやすく する。
   ふちは ひとが えらんだ いろ（--pu-ring）。えらんで いない ひとは --pu-ink */
.pu-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 2px solid var(--pu-ring, var(--pu-ink, #24304A));
  border-radius: 50%;
  background: var(--pu-u);
  font-size: 20px;
  line-height: 1;
}

.pu-icon.sm { width: 28px; height: 28px; font-size: 16px; }
.pu-icon.big { width: 58px; height: 58px; border-width: 3px; font-size: 32px; }
.pu-icon.huge { width: 96px; height: 96px; border-width: 3px; font-size: 56px; }

/* いま あそんで いる ひと。おすと きりかえ がめんが ひらく */
.pu-chip {
  max-width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 4px;
  border: 3px solid var(--_ink);
  border-radius: 99px;
  background: var(--_card);
  box-shadow: 0 3px 0 var(--_ink);
  color: var(--_ink);
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pu-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--_ink); }
.pu-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pu-chip svg { width: 18px; height: 18px; flex: none; color: var(--_soft); }

/* きりかえ・へんしゅうの がめん */
.pu-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(20, 28, 44, .5);
  color: var(--_ink);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

.pu-panel {
  max-width: 560px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--_bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pu-head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.pu-title { flex: 1; min-width: 0; margin: 0; text-align: center; font-size: 1.15rem; font-weight: 800; }

.pu-iconbtn, .pu-user-main, .pu-edit, .pu-primary, .pu-small {
  border: 3px solid var(--_ink);
  background: var(--_card);
  box-shadow: 0 4px 0 var(--_ink);
}

.pu-iconbtn:active, .pu-user-main:active, .pu-edit:active, .pu-primary:active, .pu-small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--_ink); }

.pu-iconbtn {
  width: 46px;
  height: 46px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 var(--_ink);
}

.pu-iconbtn.pu-off { visibility: hidden; }
.pu-iconbtn svg { width: 22px; height: 22px; }

.pu-lead { margin: 0; text-align: center; font-weight: 800; font-size: .92rem; color: var(--_soft); }
.pu-note { margin: 0; text-align: center; font-weight: 800; font-size: .8rem; color: var(--_soft); }

.pu-users { display: flex; flex-direction: column; gap: 12px; }
.pu-user { display: flex; align-items: stretch; gap: 8px; }

.pu-user-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
}

.pu-user.on .pu-user-main { background: var(--_hl); }
.pu-user-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; line-height: 1.35; }
.pu-user-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pu-user-name b { font-weight: 800; font-size: 1.1rem; }
.pu-now { padding: 1px 8px; border-radius: 99px; background: var(--_accent); color: #fff; font-weight: 800; font-size: .7rem; }
.pu-user-body small { font-weight: 800; font-size: .8rem; color: var(--_soft); }

.pu-edit { flex: none; width: 54px; padding: 0; border-radius: 18px; display: grid; place-items: center; }
.pu-edit svg { width: 24px; height: 24px; }

.pu-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pu-preview b { font-weight: 800; font-size: 1.2rem; text-align: center; }

.pu-field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .85rem; color: var(--_soft); }

.pu-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 3px solid var(--_ink);
  border-radius: 14px;
  background: var(--_card);
  color: var(--_ink);
  font: inherit;
  font-weight: 800;
  font-size: 1.2rem;
}

.pu-field input:focus-visible { outline: 3px solid var(--_focus); outline-offset: 2px; }

.pu-pick-title { margin: 4px 0 -6px; font-weight: 800; font-size: .8rem; letter-spacing: .1em; color: var(--_soft); }
.pu-pick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.pu-pick {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--_line);
  border-radius: 14px;
  background: var(--_card);
  font-size: 1.8rem;
  line-height: 1;
}

.pu-pick.on { border: 3px solid var(--_ink); background: var(--_hl); box-shadow: 0 3px 0 var(--_ink); }
/* ふち・なかの いろの ボタン。まるに、えらべる いろの ふち（--pu-ring）か なか（--pu-u）を つけて みせる */
.pu-ring { display: grid; place-items: center; }
.pu-ring::before { content: ""; width: 54%; aspect-ratio: 1; box-sizing: border-box; border: 5px solid var(--pu-ring, var(--_ink)); border-radius: 50%; background: var(--pu-u); }
.pu-taken { position: absolute; top: 5px; right: 5px; width: 11px; height: 11px; border: 2px solid var(--_ink); border-radius: 50%; background: var(--pu-u); }

.pu-primary {
  width: 100%;
  min-height: 60px;
  border-radius: 18px;
  background: var(--_accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
}

.pu-primary:disabled { opacity: .6; cursor: default; }

/* アイコンが おおくて ながい ので、けってい ボタンは したに くっつけて おく */
.pu-save { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ログインの じょうたい（ゲスト・ログイン ちゅう・きれた） */
.pu-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px dashed var(--_line);
  border-radius: 16px;
  background: var(--_card);
}

.pu-account.warn { border-color: var(--_accent); border-style: solid; }
.pu-account p { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; line-height: 1.4; }
.pu-account b { font-weight: 800; font-size: .95rem; overflow-wrap: anywhere; }
.pu-account small { font-weight: 800; font-size: .76rem; color: var(--_soft); }

.pu-small {
  flex: none;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--_ink);
  font-weight: 800;
  font-size: .85rem;
}

.pu-small:disabled { opacity: .6; cursor: default; }

/* ログイン・とうろくの フォーム（おうちの ひと むけ） */
.pu-form { display: flex; flex-direction: column; gap: 14px; word-break: normal; }
.pu-help { margin: 0; font-size: .85rem; line-height: 1.7; color: var(--_soft); }
.pu-error { margin: 0; font-weight: 800; font-size: .88rem; color: var(--_accent); }
.pu-error:empty { display: none; }
.pu-check { display: flex; align-items: flex-start; gap: 8px; font-weight: 800; font-size: .85rem; line-height: 1.5; }
.pu-check input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--_accent); }
.pu-links { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }

.pu-sheet .pu-link {
  padding: 6px;
  border: 0;
  background: none;
  color: var(--_focus);
  font-weight: 800;
  font-size: .88rem;
  text-decoration: underline;
}

/* ログインが きれた ときの しるし */
.pu-chip { position: relative; }
.pu-alert { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border: 2px solid var(--_card); border-radius: 50%; background: var(--_accent); }

@media (hover: hover) {
  .pu-user-main:hover, .pu-edit:hover, .pu-pick:hover, .pu-iconbtn:hover { filter: brightness(.97); }
}
