@charset "UTF-8";
/* =========================================================
   街と、その白い壁 〜throw on tako〜  ―  スタイル
   ・前作 cat-on-escape（tap-on-neko の 流れ）の みため に そろえてある
   ・おおきい文字・おおきいボタン（48px 以上）・たかいコントラスト
   ・ヘッダーは 海の 青、アクセントは 前作と おなじ 黄色
   ・ページは スクロールさせない。canvas が のこり ぜんぶを つかう
   ========================================================= */

:root {
  --c-text:        #1b1b1b;
  --c-bg:          #fff8ec;
  --c-header:      #23506e;   /* 海の 青 */
  --c-header-dark: #173a52;
  --c-header-text: #ffffff;
  --c-again:       #c65a00;   /* やりなおす：オレンジ */
  --c-kind:        #1f7a3d;   /* つぎへ：みどり */
  --c-close:       #444c55;
  --c-title:       #2f5d8a;   /* タイトル：あお */
  --c-ok:          #1f7a3d;
  --c-accent:      #ffe36e;
  --c-pick:        #c65a00;   /* えらんで いる わく */

  --fs-message: clamp(16px, 4vw, 24px);
  --fs-button:  clamp(18px, 4.6vw, 26px);
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 700;
  line-height: 1.4;
  line-break: strict;
  word-break: normal;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;            /* ページは スクロールさせない */
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; }

/* ========== ヘッダー ========== */
.header {
  flex: 0 0 auto;
  background: var(--c-header);
  color: var(--c-header-text);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 10px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .18);
  position: relative;
  z-index: 2;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status__stage {
  font-size: clamp(17px, 4.4vw, 26px);
  line-height: 1.2;
}

.status__level {
  font-size: clamp(16px, 4vw, 22px);
  background: var(--c-accent);
  color: var(--c-header-dark);
  border-radius: 999px;
  padding: 2px 14px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* こわした わりあいの バー（前作と おなじ かたち）と めあての 線 */
.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  margin: 6px auto 0;
}

.gauge {
  position: relative;
  flex: 1 1 auto;
  height: 16px;
  background: rgba(255, 255, 255, .25);
  border: 3px solid #ffffff;
  border-radius: 999px;
  overflow: hidden;
}

.gauge__bar {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
  transition: width .35s ease, background-color .3s ease;
}

.gauge.is-goal .gauge__bar { background: #7fe08f; }

/* めあての 線 */
.gauge__goal {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 70%;
  width: 4px;
  margin-left: -2px;
  background: #ff5a3c;
  box-shadow: 0 0 0 1px #ffffff;
}

.meter__text {
  flex: 0 0 auto;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: clamp(13px, 3.2vw, 17px);
  white-space: nowrap;
}

.meter__text b {
  font-size: clamp(20px, 5vw, 28px);
  color: var(--c-accent);
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
  text-align: right;
}

.meter__goal { color: #cfe3f0; }

.message {
  margin: 8px auto 0;
  max-width: 820px;
  text-align: center;
  font-size: var(--fs-message);
  background: #ffffff;
  color: var(--c-text);
  border-radius: 16px;
  padding: 6px 12px;
  min-height: 2.1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== まんなか：canvas ========== */
.field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #a8d4e6;
}

.field__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;          /* ひっぱる ときに 画面が うごかない ように */
  cursor: grab;
}

.field__canvas:active { cursor: grabbing; }
.field__canvas:focus-visible { outline: 5px solid var(--c-accent); outline-offset: -5px; }

.field__nogame {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: var(--fs-message);
  color: var(--c-header);
}

.field__nogame[hidden] { display: none; }

/* ========== した：トレイと 投げる 人と ボタン ========== */
.controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
  border-top: 6px solid var(--c-header);
}

/* --- タコの トレイ --- */
.tray__list {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.tako {
  position: relative;
  flex: 0 1 76px;
  min-width: 0;
  min-height: 56px;
  padding: 4px 2px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--c-bg);
  color: var(--c-text);
  border: 4px solid #c9d6df;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
  touch-action: manipulation;
}

.tako:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.tako:focus-visible { outline: 5px solid var(--c-accent); outline-offset: 2px; }

.tako.is-on {
  border-color: var(--c-pick);
  background: #fff1c2;
}

.tako:disabled,
.tako.is-empty {
  opacity: .42;
  cursor: default;
  box-shadow: none;
}

.tako__face {
  width: clamp(28px, 7.5vw, 40px);
  height: clamp(28px, 7.5vw, 40px);
}

.tako__name {
  font-size: clamp(11px, 2.9vw, 14px);
  line-height: 1.1;
  white-space: nowrap;
}

/* のこりの かず（右上の まる） */
.tako__count {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-header);
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 15px;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tako.is-empty .tako__count { background: #888; }
.thrower__count {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-header);
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tray__note {
  margin: 4px 0 0;
  text-align: center;
  font-size: clamp(13px, 3.4vw, 17px);
  color: var(--c-header);
  min-height: 1.4em;
}

/* --- 顔（画像が 読めた ときは 画像、だめなら 色の 丸と 字） --- */
.face {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  border: 2px solid rgba(0, 0, 0, .25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}

.face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  pointer-events: none;
}

.face.has-image {
  background: transparent !important;
  border-color: transparent;
}

/* --- 投げる 人 --- */
.throwers__list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.thrower {
  position: relative;
  min-width: 0;
  min-height: 56px;
  padding: 3px 4px 4px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 4px;
  row-gap: 1px;
  background: #ffffff;
  color: var(--c-text);
  border: 4px solid #c9d6df;
  border-radius: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
  touch-action: manipulation;
}

.thrower:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.thrower:focus-visible { outline: 5px solid var(--c-accent); outline-offset: 2px; }

.thrower.is-on {
  border-color: var(--c-pick);
  background: #fff1c2;
}

.thrower:disabled {
  opacity: .42;
  cursor: default;
  box-shadow: none;
}

.thrower__face {
  width: clamp(28px, 7.5vw, 40px);
  height: clamp(28px, 7.5vw, 40px);
  font-size: clamp(14px, 3.8vw, 18px);
}

.thrower__body { display: contents; }

.thrower__name { font-size: clamp(15px, 3.9vw, 19px); line-height: 1.15; }

.thrower__note {
  grid-column: 1 / -1;
  text-align: center;
  white-space: pre-line;
  font-size: clamp(10px, 2.7vw, 13px);
  line-height: 1.2;
  color: #4a5a66;
}

/* --- やりなおす・タイトル --- */
.actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1 1 0;
  min-height: 56px;             /* タップ領域は 48px 以上 */
  padding: 6px;
  border: 5px solid rgba(0, 0, 0, .28);
  border-radius: 20px;
  color: #ffffff;
  font-weight: 700;
  font-size: var(--fs-button);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
  transition: transform .08s ease, box-shadow .08s ease;
  touch-action: manipulation;
}

.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn:focus-visible { outline: 6px solid var(--c-accent); outline-offset: 3px; }

.btn__icon { font-size: 1em; line-height: 1; }
.btn__sub  { font-size: .6em; }

.btn--again { background: var(--c-again); }
.btn--kind  { background: var(--c-kind); }
.btn--title { background: var(--c-title); }
.btn[hidden] { display: none; }

.btn--close {
  background: var(--c-close);
  width: 100%;
  min-height: 64px;
}

/* ========== モーダル ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 40;
}

.modal[hidden] { display: none; }

.modal__panel {
  width: 100%;
  max-width: 620px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--c-bg);
  border: 6px solid var(--c-header);
  border-radius: 24px;
  padding: 16px;
  animation: pop-in .25s ease both;
}

.modal__title {
  margin: 0 0 12px;
  text-align: center;
  font-size: clamp(22px, 5.2vw, 30px);
  background: var(--c-header);
  color: #ffffff;
  border-radius: 14px;
  padding: 8px;
}

.modal__note {
  margin: 12px 0;
  text-align: center;
  font-size: clamp(14px, 3.6vw, 18px);
  color: var(--c-header);
}

/* --- レベルの おわり --- */
.modal__panel--end { max-width: 480px; }

.end__stars {
  margin: 4px 0 0;
  text-align: center;
  font-size: clamp(44px, 12vw, 68px);
  line-height: 1.1;
  letter-spacing: .08em;
  color: #e0a100;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}

.end__stars .is-off { color: #d4cfc4; }
.end__stars[hidden] { display: none; }

.end__text {
  margin: 10px 0 16px;
  text-align: center;
  font-size: clamp(17px, 4.2vw, 22px);
  white-space: pre-line;
}

.score {
  margin: -6px auto 16px;
  max-width: 360px;
  font-size: clamp(15px, 3.8vw, 18px);
}
.score[hidden] { display: none; }
.score__row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 4px; }
.score__pts { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.score__head { margin: 8px 0 2px; padding: 0 4px; font-size: .88em; color: var(--c-header); font-weight: 700; }
.score__row.is-total { border-top: 2px solid #d4cfc4; margin-top: 4px; padding-top: 6px; font-weight: 700; }
.score__row.is-stage { border-top: 3px double #d4cfc4; margin-top: 6px; padding-top: 6px; font-weight: 800; font-size: 1.12em; }
.score__row.is-best { color: #8a6d1f; font-weight: 700; }
.score__row.is-new { color: #c0392b; }
.picks__best { margin-left: 10px; font-size: .78em; font-weight: 700; color: #8a6d1f; }

.end__actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.end__actions .btn { flex: 0 0 auto; min-height: 68px; }

/* --- えらんで あそぶ --- */
.picks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picks__stage {
  margin: 0;
  padding: 8px 10px 10px;
  background: #ffffff;
  border: 4px solid #c9d6df;
  border-radius: 18px;
}

.picks__name {
  margin: 0 0 6px;
  font-size: clamp(15px, 3.8vw, 19px);
  color: var(--c-header);
}

.picks__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pick {
  min-height: 64px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--c-bg);
  color: var(--c-text);
  border: 4px solid var(--c-header);
  border-radius: 16px;
  font-weight: 700;
  font-size: clamp(18px, 4.6vw, 24px);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .18);
  touch-action: manipulation;
}

.pick:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.pick:focus-visible { outline: 5px solid var(--c-accent); outline-offset: 2px; }
.pick.is-new { background: #fff1c2; border-color: var(--c-pick); }

.pick:disabled {
  opacity: .4;
  cursor: default;
  box-shadow: none;
  border-color: #b0b8bf;
}

.pick__stars {
  font-size: .72em;
  letter-spacing: .06em;
  color: #e0a100;
  line-height: 1;
}

.pick__stars .is-off { color: #d4cfc4; }

/* ========== アニメーション ========== */
@keyframes pop-in {
  0%   { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1);  opacity: 1; }
}

/* ========== PC など 幅の ひろい 画面：したを まとめて ひくく ========== */
@media (min-width: 900px) and (min-height: 560px) {
  .controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
    align-items: center;
    gap: 16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .tray__list { justify-content: flex-start; flex-wrap: wrap; gap: 10px 8px; padding-top: 8px; }
  .tako { flex: 0 0 80px; min-height: 72px; }
  .tako__face { width: 42px; height: 42px; }
  .tako__name { font-size: 14px; }
  .tray__note { text-align: left; font-size: 16px; }
  .thrower { min-height: 72px; }
  .thrower__face { width: 42px; height: 42px; }
  .thrower__note { font-size: 13px; }
  .actions { flex-direction: column; gap: 10px; }
  .actions .btn { min-height: 56px; padding: 4px 18px; }
}

/* ========== せの ひくい 画面 ========== */
@media (max-height: 700px) {
  .header { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
  .message { margin-top: 6px; padding: 4px 10px; min-height: 1.8em; }
  .controls { gap: 5px; padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .btn { min-height: 50px; }
}

/* ========== よこ向きの スマホ：ボタンを 右に ならべる ========== */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --fs-message: 15px; --fs-button: 17px; }

  body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(220px, 34vw, 330px);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "head side"
      "field side";
  }

  .header {
    grid-area: head;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 10px 6px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
  }
  .status { flex-wrap: nowrap; gap: 6px; justify-content: flex-start; }
  .status__stage { font-size: 15px; white-space: nowrap; }
  .status__level { font-size: 14px; padding: 1px 10px; }
  .meter { margin: 0; }
  .gauge { height: 12px; border-width: 2px; }
  .meter__text b { font-size: 18px; }
  .meter__text { font-size: 12px; }
  .message {
    grid-column: 1 / -1;
    margin: 0;
    max-width: none;
    min-height: 0;
    padding: 2px 8px;
    border-radius: 10px;
  }

  .field { grid-area: field; }

  .controls {
    grid-area: side;
    border-top: 0;
    border-left: 6px solid var(--c-header);
    padding: calc(6px + env(safe-area-inset-top, 0px)) calc(8px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) 8px;
    gap: 6px;
    justify-content: space-between;
    min-height: 0;
    overflow: hidden;
  }
  .tray__list { flex-wrap: wrap; gap: 8px 5px; padding-top: 6px; }
  .tako { flex: 0 1 calc(25% - 5px); min-height: 50px; }
  .tako__face { width: 26px; height: 26px; }
  .tako__count { min-width: 22px; height: 22px; font-size: 13px; line-height: 18px; top: -7px; right: -5px; }
  .tray__note { font-size: 12px; margin-top: 2px; }
  .throwers__list { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  .thrower { min-height: 48px; padding: 2px 4px; border-width: 3px; border-radius: 12px; }
  .thrower__face { width: 28px; height: 28px; font-size: 13px; }
  .thrower__name { font-size: 14px; }
  .thrower__note { font-size: 10px; }
  .actions { gap: 6px; }
  .btn { min-height: 48px; border-width: 4px; border-radius: 16px; padding: 2px; }
  .btn__icon { display: none; }

  .modal__panel { padding: 10px; }
  .modal__title { font-size: 18px; padding: 5px; margin-bottom: 8px; }
  .modal__note { margin: 8px 0; font-size: 13px; }
  .end__stars { font-size: 34px; }
  .end__text { margin: 4px 0 10px; font-size: 15px; }
  .end__actions { flex-direction: row; gap: 10px; }
  .end__actions .btn { flex: 1 1 0; min-height: 52px; }
  .btn--close { min-height: 48px; }
  .picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pick { min-height: 52px; font-size: 16px; }
}

/* とても せまい たて画面 */
@media (max-width: 360px) {
  .thrower__note { display: none; }
  .tako__name { font-size: 10px; }
}

/* タコが 6しゅるい 以上：1れつの よこスライド（どの 画面でも。上の 画面ごとの 指定より つよく する） */
.tray__list.tray__list--scroll {
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 8px 6px 2px;        /* 右上の かずの まるが 切れない ように */
  margin: -4px 0 0;
  scroll-snap-type: x proximity;
  scroll-padding: 0 8px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tray__list--scroll .tako {
  flex: 0 0 clamp(62px, 17vw, 80px);
  scroll-snap-align: start;
}
/* つづきが ある 側を うすく ぼかす（スライドできる しるし） */
.tray__list--scroll.is-more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tray__list--scroll.is-more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.tray__list--scroll.is-more-left.is-more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

/* アニメーションが にがてな ひとの ために */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
