/**
 * Ink Drop - Game Specific Scoped Stylesheet
 * Copyright (c) 2026 kixking. All rights reserved.
 *
 * CSS分離アーキテクチャ（B案）準拠: 固有スタイルは ind-* プレフィックスで当ファイルに独立管理。
 */

body.ind-body {
  /* Stage fits the viewport height on phones (3:4 field + HUD + header) */
  --ind-stage-w: min(100%, calc((100svh - 150px) * 0.75), 480px);

  & .site-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 1.25rem 1rem 4rem;
  }

  & .profile-header {
    max-width: 100%;
    margin-bottom: 0.75rem;
  }
}

:where(body.ind-body) :where(button) {
  font-family: inherit;
}

.ind-game {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- HUD ---------- */

.ind-hud {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  width: var(--ind-stage-w);
  padding: 0 0.15rem 0.6rem;
}

.ind-hud-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ind-hud-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.ind-hud-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ind-hud-combo {
  min-width: 5.5rem;

  &.is-hot .ind-hud-value {
    color: var(--accent-ink);
  }
}

.ind-lives {
  display: flex;
  gap: 5px;
  height: 1.375rem;
  align-items: center;
}

.ind-life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  transition: background-color 0.2s ease, border-color 0.2s ease;

  &.is-used {
    background: var(--text-primary);
    border-color: var(--text-primary);
  }
}

.ind-sound-btn {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: -6px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  cursor: pointer;

  & .ind-icon-on {
    display: none;
  }

  &[aria-pressed="true"] {
    color: var(--text-primary);
    border-color: var(--border-medium);

    & .ind-icon-on { display: block; }
    & .ind-icon-off { display: none; }
  }

  &:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
  }
}

/* ---------- Stage ---------- */

.ind-stage {
  position: relative;
  width: var(--ind-stage-w);
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-page);
  box-shadow: 0 1px 0 var(--border-subtle), 0 18px 40px -24px rgba(0, 0, 0, 0.35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ind-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ind-stage.is-playing .ind-canvas {
  cursor: crosshair;
}

/* ---------- Overlays ---------- */

.ind-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-surface);   /* fallback: Safari < 16.2 lacks color-mix() */
  background: color-mix(in srgb, var(--bg-page) 82%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  &[hidden] {
    display: none;
  }
}

.ind-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.ind-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
}

.ind-lead {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.ind-rules {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--text-secondary);

  & strong {
    color: var(--accent-ink);
  }
}

.ind-btn-primary,
.ind-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  min-width: 10rem;
  padding: 0 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;

  &:active {
    transform: scale(0.97);
  }

  &:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 3px;
  }
}

.ind-btn-primary {
  color: var(--bg-page);
  background: var(--text-primary);
  border: 1px solid var(--text-primary);
}

.ind-btn-secondary {
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-medium);
}

.ind-best-line {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ind-best {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.ind-final {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 16vw, 4.4rem);
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ind-record {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
}

.ind-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 7rem));
  gap: 0.5rem 1.25rem;
  margin: 0.6rem 0 0.9rem;

  & div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
  }

  & dt {
    font-size: 0.68rem;
    color: var(--text-muted);
  }

  & dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-primary);
  }
}

.ind-over-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ind-footnote {
  width: var(--ind-stage-w);
  margin: 0.6rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 600px) {
  body.ind-body .site-container {
    padding: 2rem 1.5rem 5rem;
  }

  .ind-over-actions {
    flex-direction: row;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ind-btn-primary,
  .ind-btn-secondary,
  .ind-life {
    transition: none;
  }
}
