/* お絵描きスタジオ (css/style.css の :root トークンを使用) */
.studio {
  --st-shadow: #0b0812;
  box-sizing: border-box; width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto;
  padding: 10px 12px 14px; color: var(--ink); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.studio *, .studio *::before, .studio *::after { box-sizing: border-box; }
.studio button { font-family: inherit; }

/* ---- 上部バー ---- */
.studio-top { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 0 auto 10px; flex-wrap: wrap; }
.studio-theme {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0;
  background: var(--panel); border-radius: var(--radius); padding: 6px 8px 6px 12px;
  box-shadow: 0 4px 0 var(--st-shadow);
}
.studio-theme-label {
  background: var(--yellow); color: #3a2a00; font-weight: 900; font-size: 12px; letter-spacing: .1em;
  padding: 3px 8px; border-radius: 999px; flex: none;
}
.studio-theme-text { flex: 1; min-width: 0; font-weight: 900; font-size: clamp(16px, 4.4vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-theme-text.pop { animation: st-pop .35s cubic-bezier(.2, 1.6, .4, 1); }

/* ---- ボタン(粘土の厚み) ---- */
.st-btn {
  appearance: none; border: 0; cursor: pointer; touch-action: manipulation;
  background: var(--clay); color: #2a2030; font-weight: 800; font-size: 15px; line-height: 1.1;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius);
  box-shadow: 0 4px 0 #a79f8c, 0 6px 8px rgba(0, 0, 0, .35);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.st-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #a79f8c; }
.st-btn:disabled { opacity: .4; cursor: default; }
.st-btn:focus-visible, .st-swatch:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.st-small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.st-tool.is-on, .st-toggle.is-on { background: var(--yellow); box-shadow: 0 4px 0 #b88a00, 0 6px 8px rgba(0, 0, 0, .35); }
.st-primary {
  background: var(--red); color: #fff; font-size: clamp(20px, 5vw, 26px); font-weight: 900; min-height: 60px; width: 100%;
  box-shadow: 0 6px 0 #9c2616, 0 10px 16px rgba(0, 0, 0, .4); text-shadow: 0 2px 0 rgba(0, 0, 0, .25); letter-spacing: .04em;
}
.st-primary:active:not(:disabled) { box-shadow: 0 2px 0 #9c2616; transform: translateY(4px); }

/* ---- レイアウト ---- */
.studio-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1100px; margin: 0 auto; }
@media (min-width: 880px) {
  .studio-body { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .studio-panel { position: sticky; top: 0; }
}

/* ---- キャンバス ---- */
.studio-stage {
  position: relative; width: min(100%, 680px, max(280px, calc(100dvh - 250px))); aspect-ratio: 1; margin: 0 auto;
  background: radial-gradient(circle at 50% 40%, #3a2d52, var(--panel) 70%);
  border-radius: 22px; box-shadow: 0 6px 0 var(--st-shadow), inset 0 0 0 3px rgba(255, 255, 255, .06); overflow: hidden;
}
.studio-clay {
  position: absolute; left: 8%; top: 2%; width: 84%; height: 96%; border-radius: 50%;
  background: radial-gradient(ellipse at 36% 28%, #ffffff 0%, #f6f2e9 38%, #e4dccb 75%, #cbc2ae 100%);
  box-shadow: inset -16px -22px 36px rgba(120, 100, 70, .3), inset 10px 10px 24px rgba(255, 255, 255, .7), 0 16px 30px rgba(0, 0, 0, .5);
}
.studio-clay::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background-image: var(--clay-noise); opacity: .5; mix-blend-mode: multiply; }
.studio-guide, .studio-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.studio-guide { pointer-events: none; transition: opacity .2s; }
.studio-stage.no-guide .studio-guide { opacity: 0; }
.studio-canvas { touch-action: none; cursor: crosshair; }
.studio-stage.is-eraser .studio-canvas { cursor: cell; }
.studio-cursor {
  display: none; position: absolute; left: 0; top: 0; pointer-events: none; border-radius: 50%;
  border: 2px solid rgba(20, 16, 28, .75); box-shadow: 0 0 0 1px rgba(255, 255, 255, .85);
}
.studio-hint {
  position: absolute; left: 0; right: 0; top: 7%; text-align: center; pointer-events: none;
  font-weight: 900; font-size: clamp(18px, 4.5vw, 28px); color: rgba(60, 50, 40, .35); transition: opacity .25s;
}
.studio-stage.has-ink .studio-hint { opacity: 0; }

/* ---- ツール ---- */
.studio-tools { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.studio-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; }
.studio-size { display: flex; align-items: center; gap: 10px; flex: 1 1 150px; min-width: 150px; max-width: 280px; background: var(--panel); border-radius: var(--radius); padding: 0 12px; min-height: 44px; }
.studio-size-dot { --dot: #1b1b1f; flex: none; width: 20px; height: 20px; max-width: 34px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); display: block; }
.studio-size-range { flex: 1; min-width: 0; height: 32px; accent-color: var(--yellow); touch-action: pan-y; }
.studio-palette { gap: 7px; }
.st-swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .85); background: var(--c); cursor: pointer; padding: 0;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45); transition: transform .1s;
}
.st-swatch.is-on { transform: scale(1.18) translateY(-2px); border-color: var(--yellow); box-shadow: 0 0 0 3px var(--red), 0 4px 0 rgba(0, 0, 0, .45); }

/* ---- パネル ---- */
.studio-panel {
  background: var(--panel); border-radius: 22px; padding: 14px 14px 14px; box-shadow: 0 6px 0 var(--st-shadow);
  display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center;
}
.studio-rank { display: flex; align-items: center; justify-content: center; gap: 10px; }
.studio-rank-letter {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: #3a2a00;
  font-weight: 900; font-size: 26px; box-shadow: 0 3px 0 #b88a00;
}
.studio-rank-total { font-weight: 900; font-size: 18px; color: var(--yellow); }
.studio-nick {
  font-weight: 900; font-size: clamp(26px, 7vw, 34px); line-height: 1.15; text-shadow: 0 3px 0 rgba(0, 0, 0, .45); word-break: keep-all; overflow-wrap: anywhere;
}
.studio-nick.pop { animation: st-pop .4s cubic-bezier(.2, 1.7, .4, 1); }
.studio-radar { width: 100%; max-width: 440px; height: auto; align-self: center; }
.studio-traits { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 28px; }
.st-chip { background: rgba(255, 247, 234, .12); border: 2px solid rgba(255, 247, 234, .25); color: var(--ink); font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.studio-comment { font-weight: 700; font-size: 15px; line-height: 1.5; color: #ffd9a8; min-height: 3em; padding: 2px 4px; }
.studio-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.studio-save { display: flex; gap: 8px; justify-content: center; }

/* ---- スマホ: 下部固定のミニバー(あだ名+ミニレーダー+戦うボタン) ---- */
.studio-dock { display: none; }
@media (max-width: 879px) {
  .studio-actions .st-primary { display: none; }
  .studio { padding-bottom: 0; }
  .studio-dock {
    display: flex; align-items: center; gap: 10px; position: sticky; bottom: 0; z-index: 5; margin: 12px -12px 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, #1a1327 80%, rgba(26, 19, 39, .92)); border-top: 2px solid rgba(255, 247, 234, .12);
  }
  .studio-dock-radar { width: 54px; height: 54px; flex: none; }
  .studio-dock-info { flex: 1; min-width: 0; text-align: left; }
  .studio-dock-nick { font-weight: 900; font-size: 18px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .studio-dock-rank { font-weight: 800; font-size: 12px; color: var(--yellow); }
  .st-dock-go { display: block !important; width: auto; flex: none; min-height: 52px; padding: 0 20px; font-size: 20px; }
}
@media (max-width: 520px) {
  .studio-palette { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); justify-items: center; max-width: 340px; width: 100%; margin: 0 auto; row-gap: 10px; }
  .st-swatch { width: 40px; height: 40px; }
}
@keyframes st-pop { 0% { transform: scale(.6); opacity: .2; } 100% { transform: scale(1); opacity: 1; } }
