/* =====================================================
   なんぷん? — テーマパーク待ち時間ボード
   レトロ遊園地チケット売り場デザイン
   ===================================================== */

:root {
  --paper: #faf3e3;
  --paper-deep: #f3e8cf;
  --ink: #21294a;
  --ink-soft: #5a5f7a;
  --red: #e84855;
  --red-deep: #c93340;
  --mustard: #f5b841;
  --teal: #2e9e8f;
  --green: #3fa34d;
  --orange: #e87a2c;
  --gray: #9aa0b0;
  --card-shadow: 0 2px 0 rgba(33, 41, 74, .16), 0 10px 24px -14px rgba(33, 41, 74, .35);
  --font-display: "Mochiy Pop One", sans-serif;
  --font-body: "Zen Maru Gothic", sans-serif;
  --font-num: "Lilita One", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(33, 41, 74, .05) 1.2px, transparent 1.3px),
    radial-gradient(rgba(232, 72, 85, .045) 1.2px, transparent 1.3px);
  background-size: 26px 26px, 26px 26px;
  background-position: 0 0, 13px 13px;
  color: var(--ink);
  line-height: 1.6;
}

::selection { background: var(--mustard); color: var(--ink); }

/* =============== ヘッダー(テントのひさし) =============== */

.awning {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.awning-stripes {
  height: 14px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 18px,
    var(--paper) 18px 36px
  );
}

/* マーキー電球 */
.marquee {
  display: flex;
  justify-content: center;
  gap: 26px;
  padding: 14px 0 0;
}
.marquee span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mustard);
  box-shadow: 0 0 10px 2px rgba(245, 184, 65, .75);
  animation: bulb 1.6s ease-in-out infinite;
}
.marquee span:nth-child(2n) { animation-delay: .4s; }
.marquee span:nth-child(3n) { animation-delay: .8s; }
.marquee span:nth-child(5n) { animation-delay: 1.2s; }
@keyframes bulb {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; box-shadow: none; }
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 46px;
  text-align: center;
}

.header-kicker {
  font-family: var(--font-num);
  font-size: .72rem;
  letter-spacing: .32em;
  color: var(--mustard);
  margin-bottom: 10px;
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.15;
  text-shadow: 4px 4px 0 var(--red);
  transform: rotate(-1.2deg);
}
.site-title .q {
  display: inline-block;
  color: var(--mustard);
  transform: rotate(8deg);
  animation: wobble 3s ease-in-out infinite;
}
@keyframes wobble {
  0%, 100% { transform: rotate(8deg); }
  50% { transform: rotate(-4deg) translateY(-4px); }
}

.site-sub {
  margin-top: 12px;
  font-size: .95rem;
  color: rgba(250, 243, 227, .85);
}
.site-sub .dot {
  color: var(--red);
  margin: 0 .6em;
  font-size: .6em;
  vertical-align: middle;
}

/* スカラップ(波形の裾) */
.awning-scallop {
  height: 22px;
  background:
    radial-gradient(circle at 50% 0, var(--ink) 21px, transparent 22px);
  background-size: 44px 22px;
  background-position: 0 0;
  position: absolute;
  left: 0; right: 0; bottom: -22px;
  z-index: 2;
}

/* =============== レイアウト =============== */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 52px 20px 60px;
}

/* =============== パーク選択チケット =============== */

.tickets {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 30px;
}

.ticket {
  position: relative;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(33, 41, 74, .9);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
/* チケットの切り欠き */
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  transform: translateY(-50%);
}
.ticket::before { left: -9px; }
.ticket::after { right: -9px; }

.ticket .ticket-icon { margin-right: .45em; }
.ticket .ticket-short {
  display: block;
  font-family: var(--font-num);
  font-size: .62rem;
  letter-spacing: .22em;
  color: var(--ink-soft);
}

.ticket:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 4px 5px 0 rgba(33, 41, 74, .9);
}

.ticket.is-active {
  background: var(--red);
  color: #fff;
  transform: rotate(-1.5deg) scale(1.04);
  box-shadow: 4px 4px 0 var(--ink);
}
.ticket.is-active .ticket-short { color: rgba(255, 255, 255, .8); }
.ticket.is-active::before,
.ticket.is-active::after { background: var(--paper); }

/* =============== サマリーボード =============== */

.board {
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 6px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}

.board-inner {
  border: 2px dashed rgba(250, 243, 227, .35);
  border-radius: 12px;
  padding: 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 14px;
}

.board-stat { text-align: center; min-width: 110px; }

.board-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--mustard);
  margin-bottom: 4px;
}

.board-value {
  font-family: var(--font-num);
  font-size: 2rem;
  line-height: 1.1;
  color: var(--paper);
}
.board-value--small {
  font-size: 1.25rem;
  font-family: var(--font-body);
  font-weight: 700;
}
.board-value .unit {
  font-size: .55em;
  margin-left: 2px;
  font-family: var(--font-body);
  font-weight: 700;
}

.board-countdown {
  display: block;
  font-size: .7rem;
  color: rgba(250, 243, 227, .6);
  margin-top: 2px;
}

.board-divider {
  width: 2px;
  height: 42px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(250, 243, 227, .35) 0 4px,
    transparent 4px 8px
  );
}

/* =============== 操作列 =============== */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 26px;
}

.seg {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(33, 41, 74, .85);
}
.seg-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .85rem;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 8px 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.is-active {
  background: var(--teal);
  color: #fff;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; }
.toggle-track {
  width: 42px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  position: relative;
  transition: background .18s;
  box-shadow: 2px 2px 0 rgba(33, 41, 74, .85);
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .18s ease;
}
.toggle input:checked + .toggle-track { background: var(--mustard); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--teal); outline-offset: 2px; }

.refresh-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(33, 41, 74, .85);
  transition: transform .15s, background .15s;
}
.refresh-btn:hover { background: var(--red-deep); transform: translateY(-2px); }
.refresh-icon {
  display: inline-block;
  margin-right: .4em;
  font-weight: 400;
}
.refresh-btn.is-loading .refresh-icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============== 通知バナー =============== */

.notice {
  background: #fff;
  border: 2px dashed var(--red);
  border-radius: 12px;
  color: var(--red-deep);
  font-weight: 700;
  text-align: center;
  padding: 12px 16px;
  margin-bottom: 22px;
}

/* =============== アトラクションカード =============== */

.rides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}

.ride {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  opacity: 0;
  transform: translateY(14px);
  animation: rise .45s ease forwards;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ride:hover {
  transform: translateY(-3px) rotate(-.4deg);
  box-shadow: 0 3px 0 rgba(33, 41, 74, .16), 0 16px 30px -14px rgba(33, 41, 74, .4);
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.ride-main {
  flex: 1;
  padding: 13px 14px 12px 16px;
  min-width: 0;
}

.ride-name {
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.4;
}
.ride-sub {
  font-size: .68rem;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 待ち時間チップ(ミシン目で切り離すスタブ風) */
.ride-stub {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 2px dashed var(--ink);
  padding: 8px 6px;
  color: #fff;
  text-align: center;
}
.ride-stub .num {
  font-family: var(--font-num);
  font-size: 1.9rem;
  line-height: 1;
}
.ride-stub .unit {
  font-size: .68rem;
  font-weight: 700;
  margin-top: 2px;
}

.w-low     { background: var(--green); }
.w-mid     { background: var(--mustard); color: var(--ink) !important; }
.w-mid .unit { color: var(--ink); }
.w-high    { background: var(--orange); }
.w-extreme { background: var(--red); animation: pulse-red 2s ease-in-out infinite; }
.w-closed  { background: var(--gray); }
.w-closed .num { font-size: .95rem; font-family: var(--font-body); font-weight: 700; }

@keyframes pulse-red {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

.ride.is-closed { opacity: .68; }
.ride.is-closed .ride-name { color: var(--ink-soft); }

/* ローディング・スケルトン */
.skeleton {
  height: 76px;
  border-radius: 14px;
  border: 2px solid rgba(33, 41, 74, .12);
  background: linear-gradient(100deg, #fff 40%, var(--paper-deep) 50%, #fff 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

.empty-message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 40px 0;
}

/* =============== ニュース =============== */

.news {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.news-head {
  background: var(--paper-deep);
  border-bottom: 2px solid var(--ink);
  padding: 16px 20px;
}

.news-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.news-flag {
  font-family: var(--font-num);
  font-size: .66rem;
  letter-spacing: .18em;
  background: var(--red);
  color: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  transform: rotate(-3deg);
}
.news-sub {
  font-size: .76rem;
  color: var(--ink-soft);
  margin-top: 3px;
}

.news-list { list-style: none; }

.news-item { border-bottom: 1px dashed rgba(33, 41, 74, .25); }
.news-item:last-child { border-bottom: none; }

.news-link {
  display: block;
  padding: 13px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: background .15s;
}
.news-link:hover { background: var(--paper); }

.news-item-title {
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.5;
}
.news-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  font-size: .72rem;
  color: var(--ink-soft);
}
.news-source {
  background: var(--paper-deep);
  border-radius: 5px;
  padding: 1px 8px;
  font-weight: 700;
}
.news-loading, .news-error {
  padding: 24px 20px;
  color: var(--ink-soft);
  font-size: .85rem;
  text-align: center;
}

/* =============== フッター =============== */

.footer {
  background: var(--ink);
  color: rgba(250, 243, 227, .85);
  margin-top: 70px;
  border-top: 6px solid var(--red);
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 20px 42px;
  text-align: center;
  font-size: .8rem;
}
.footer-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--paper);
  margin-bottom: 10px;
}
.footer a { color: var(--mustard); }
.footer-note {
  margin-top: 12px;
  font-size: .72rem;
  color: rgba(250, 243, 227, .55);
}

/* =============== レスポンシブ・モーション設定 =============== */

@media (max-width: 640px) {
  .board-divider { display: none; }
  .board-inner { gap: 8px; }
  .board-stat { min-width: 45%; }
  .rides { grid-template-columns: 1fr; }
  .marquee { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .ride { opacity: 1; transform: none; }
}
