/* 算数おためしコンテンツのプレーヤー（ホーム画面と同じ紺・角丸のトーン） */

:root {
  --navy: #0b3a8f;
  --navy-dark: #062660;
  --line: #d6dfee;
  --bg: #eef3fb;
  --letterbox: #0f2350;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: #222;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Meiryo", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

button { font: inherit; }

.player {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---------- ヘッダー ---------- */

.player__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  flex: none;
  height: clamp(44px, 8vh, 60px);
  padding: 0 clamp(8px, 1.6vw, 20px);
  background: var(--navy);
  color: #fff;
}

.player__title {
  margin: 0;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 700;
  white-space: nowrap;
}

.player__subject {
  display: inline-block;
  margin-right: .6em;
  padding: .15em .6em;
  border-radius: 4px;
  background: #fff;
  color: #1a8fd8;
  font-size: .85em;
}

.player__count {
  justify-self: end;
  margin: 0;
  font-size: clamp(13px, 1.4vw, 17px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.player__home {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .55em 1.1em .55em .9em;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50px;
  color: #fff;
  font-size: clamp(12px, 1.3vw, 15px);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s;
}

.player__home:hover { background: rgba(255, 255, 255, .15); }

.player__home svg {
  width: 1.2em;
  height: 1.2em;
}

/* ---------- 教材 ---------- */

.player__main {
  flex: 1;
  min-height: 0;
}

.player__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

/* ---------- フッター ---------- */

.player__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
  height: clamp(56px, 11vh, 84px);
  padding: 0 clamp(12px, 2.4vw, 32px) 4px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.player__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-width: clamp(110px, 13vw, 160px);
  padding: .75em 1.4em;
  border: 2px solid var(--navy);
  border-radius: 50px;
  background: #fff;
  box-shadow: 0 4px 0 var(--navy-dark);
  color: var(--navy);
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.player__btn--next {
  background: var(--navy);
  color: #fff;
}

.player__btn--end {
  border-color: #e8890c;
  background: #f5a623;
  box-shadow: 0 4px 0 #b86a00;
}

.player__btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--navy-dark);
}

.player__btn:focus-visible,
.player__home:focus-visible {
  outline: 3px solid #f5a623;
  outline-offset: 2px;
}

/* 進み具合 */
.player__dots {
  display: flex;
  gap: clamp(6px, 1vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.player__dots li {
  width: clamp(8px, 1vw, 12px);
  height: clamp(8px, 1vw, 12px);
  border-radius: 50%;
  background: var(--line);
}

.player__dots .is-done { background: #8fb0e3; }
.player__dots .is-current { background: var(--navy); transform: scale(1.3); }

/* ---------- スマホ縦向きの案内（ホームと同じ） ---------- */

.rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  background: var(--letterbox);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.rotate p { margin: 0; }

.rotate__icon {
  width: 48px;
  height: 80px;
  border: 4px solid #fff;
  border-radius: 10px;
  animation: rotate-hint 2.4s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 25%   { transform: rotate(0); }
  50%, 75%  { transform: rotate(-90deg); }
  100%      { transform: rotate(0); }
}

@media (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .rotate { display: flex; }
  .player { display: none; }
}
