/* 打矢アプリ — shell styles */

:root {
  --font:
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.36, 1);
  --tab-h: 58px;
  --page-x: 20px;
  --radius-tile: 26px;
  --radius-card: 28px;
  --radius-pill: 999px;
  --mod-calendar: #4c6fff;
  --mod-wishlist: #e39b12;
  --mod-dance: #ef5b7a;
  --mod-money: #14a484;
  --mod-study: #7a5cff;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f0eb;
  --bg-deep: #e8e3da;
  --ink: #17141f;
  --ink-2: #5c566c;
  --ink-3: #8b8498;
  --card: rgba(255, 252, 248, 0.72);
  --card-strong: rgba(255, 252, 248, 0.9);
  --stroke: rgba(23, 20, 31, 0.08);
  --stroke-strong: rgba(23, 20, 31, 0.14);
  --shadow: 0 12px 32px rgba(40, 28, 50, 0.08);
  --shadow-press: 0 4px 14px rgba(40, 28, 50, 0.08);
  --accent: #e85d4c;
  --accent-2: #3e3a8f;
  --gold: #b8923a;
  --gold-soft: rgba(200, 154, 60, 0.16);
  --glass: blur(22px) saturate(1.45);
  --orb-a: rgba(232, 93, 76, 0.28);
  --orb-b: rgba(62, 58, 143, 0.22);
  --orb-c: rgba(200, 154, 60, 0.18);
  --tab-bg: rgba(255, 252, 248, 0.78);
  --theme-btn: rgba(23, 20, 31, 0.06);
  --chip: rgba(23, 20, 31, 0.05);
  --status: #f3f0eb;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0d14;
  --bg-deep: #08070c;
  --ink: #f5f1ea;
  --ink-2: #b7b1c4;
  --ink-3: #817b90;
  --card: rgba(30, 28, 44, 0.7);
  --card-strong: rgba(34, 32, 50, 0.88);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  --shadow-press: 0 6px 16px rgba(0, 0, 0, 0.3);
  --accent: #ff7a6b;
  --accent-2: #9b96e8;
  --gold: #e8c547;
  --gold-soft: rgba(232, 197, 71, 0.14);
  --glass: blur(24px) saturate(1.5);
  --orb-a: rgba(255, 122, 107, 0.22);
  --orb-b: rgba(122, 92, 255, 0.2);
  --orb-c: rgba(232, 197, 71, 0.1);
  --tab-bg: rgba(22, 20, 34, 0.78);
  --theme-btn: rgba(255, 255, 255, 0.08);
  --chip: rgba(255, 255, 255, 0.06);
  --status: #0e0d14;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

/* Ambient background */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-deep), transparent 60%),
    var(--bg);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.9;
  animation: drift 18s var(--ease-out) infinite alternate;
}

.orb-a {
  width: 280px;
  height: 280px;
  right: -80px;
  top: 8%;
  background: var(--orb-a);
}

.orb-b {
  width: 320px;
  height: 320px;
  left: -120px;
  top: 38%;
  background: var(--orb-b);
  animation-duration: 22s;
  animation-delay: -6s;
}

.orb-c {
  width: 240px;
  height: 240px;
  right: 10%;
  bottom: 8%;
  background: var(--orb-c);
  animation-duration: 26s;
  animation-delay: -3s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-24px, 30px, 0) scale(1.08);
  }
}

.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
}

.view-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: calc(10px + env(safe-area-inset-top)) var(--page-x)
    calc(var(--tab-h) + 28px + env(safe-area-inset-bottom));
}

/* Transitions */
.view-layer.is-enter-right {
  transform: translate3d(28%, 0, 0);
  opacity: 0;
}

.view-layer.is-enter-left {
  transform: translate3d(-16%, 0, 0);
  opacity: 0;
}

.view-layer.is-enter-fade {
  transform: translate3d(0, 6px, 0);
  opacity: 0;
}

.view-layer.is-animating {
  transition:
    transform 0.42s var(--ease-out),
    opacity 0.34s ease;
}

.view-layer.is-leave-left {
  transform: translate3d(-16%, 0, 0);
  opacity: 0;
}

.view-layer.is-leave-right {
  transform: translate3d(28%, 0, 0);
  opacity: 0;
}

.view-layer.is-leave-fade {
  transform: translate3d(0, 4px, 0);
  opacity: 0;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: url("../icons/icon-192.png") center / cover no-repeat;
  box-shadow: 0 6px 14px rgba(40, 20, 60, 0.22);
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--theme-btn);
  border: 1px solid var(--stroke);
  color: var(--ink);
  transition:
    transform 0.18s var(--ease-out),
    background 0.18s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Home header */
.hello {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.date-block {
  margin: 0 0 14px;
}

.date-main {
  display: block;
  font-size: clamp(34px, 9.5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.08;
  color: var(--ink);
}

.date-sub {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
}

/* Countdown card */
.countdown {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  padding: 16px 16px 14px;
  border-radius: var(--radius-card);
  background: var(--card);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.countdown::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, var(--gold-soft), transparent 70%);
  pointer-events: none;
}

.ring {
  width: 86px;
  height: 86px;
  position: relative;
  grid-row: span 2;
  align-self: center;
}

.ring svg {
  width: 86px;
  height: 86px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--stroke-strong);
  stroke-width: 6.5;
}

.ring-fg {
  fill: none;
  stroke: var(--gold);
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-dasharray: 227;
  stroke-dashoffset: 227;
  transition: stroke-dashoffset 1s var(--ease-out);
}

.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.ring-num strong {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-num span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 2px;
}

.cd-kicker {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.cd-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.cd-title em {
  font-style: normal;
  color: var(--accent);
}

.cd-date {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.exam-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  overflow-x: auto;
}

.exam-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.exam-chip {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: var(--chip);
  border: 1px solid var(--stroke);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.exam-chip small {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
}

.exam-chip.is-next {
  background: var(--gold-soft);
  border-color: transparent;
  color: var(--gold);
}

.exam-chip.is-today {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.exam-gap {
  width: 4px;
  align-self: center;
  height: 2px;
  border-radius: 1px;
  background: var(--stroke-strong);
}

/* Section */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 4px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

/* Tile grid */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 14px;
  border-radius: var(--radius-tile);
  background: var(--card);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.tile:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-press);
}

.tile-featured {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: flex-start;
  min-height: 0;
  padding: 16px 16px 14px;
}

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--tile-color) 38%, transparent);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--tile-color) 82%, #fff) 0%,
    var(--tile-color) 100%
  );
}

.tile-icon svg {
  width: 22px;
  height: 22px;
}

.tile[data-color="calendar"] {
  --tile-color: var(--mod-calendar);
}
.tile[data-color="wishlist"] {
  --tile-color: var(--mod-wishlist);
}
.tile[data-color="dance"] {
  --tile-color: var(--mod-dance);
}
.tile[data-color="money"] {
  --tile-color: var(--mod-money);
}
.tile[data-color="study"] {
  --tile-color: var(--mod-study);
}

.tile-copy {
  margin-top: 0;
  min-width: 0;
  flex: 1;
  width: 100%;
}

.tile-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  word-break: keep-all;
}

.tile-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1.4;
}

.tile-featured-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.tile-featured-row .tile-copy {
  margin: 0;
  flex: 1;
}

.subchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  width: 100%;
}

.subchip {
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--mod-study) 12%, transparent);
  color: color-mix(in srgb, var(--mod-study) 80%, var(--ink));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

:root[data-theme="dark"] .subchip {
  color: #cbbfff;
  background: rgba(122, 92, 255, 0.16);
}

/* Install tip */
.install-tip {
  margin-top: 16px;
  padding: 14px 14px 14px 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px dashed var(--stroke-strong);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
}

.install-tip p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.install-tip p strong {
  color: var(--ink);
  font-weight: 700;
}

.tip-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  flex-shrink: 0;
}

.tip-close:active {
  background: var(--theme-btn);
}

/* Module / placeholder pages */
.page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 12px;
}

.back-btn {
  width: 40px;
  height: 40px;
  margin-left: -6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background 0.18s ease, transform 0.18s var(--ease-out);
}

.back-btn:active {
  transform: scale(0.92);
  background: var(--theme-btn);
}

.back-btn svg {
  width: 22px;
  height: 22px;
}

.page-nav h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.placeholder {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 8px 4px;
}

.ph-icon {
  width: 84px;
  height: 84px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 20px;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--tile-color) 82%, #fff),
    var(--tile-color)
  );
  box-shadow: 0 16px 32px color-mix(in srgb, var(--tile-color) 36%, transparent);
}

.ph-icon svg {
  width: 40px;
  height: 40px;
}

.placeholder h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.ph-badge {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--theme-btn);
  border: 1px solid var(--stroke);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}

.placeholder p {
  margin: 12px 0 0;
  max-width: 28em;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
}

.feature-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
}

.feature-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tile-color, var(--mod-study)) 14%, transparent);
  color: var(--tile-color, var(--mod-study));
  flex-shrink: 0;
}

.feature-ico svg {
  width: 20px;
  height: 20px;
}

.feature-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.feature-item span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

/* Tab bar */
.tabbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
  height: var(--tab-h);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  padding: 4px;
  border-radius: 24px;
  background: var(--tab-bg);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px rgba(20, 14, 30, 0.14);
}

.tab {
  height: 100%;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.18s var(--ease-out);
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.tab.is-active {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.tab[data-color="calendar"].is-active {
  color: var(--mod-calendar);
  background: color-mix(in srgb, var(--mod-calendar) 12%, transparent);
}
.tab[data-color="wishlist"].is-active {
  color: var(--mod-wishlist);
  background: color-mix(in srgb, var(--mod-wishlist) 12%, transparent);
}
.tab[data-color="dance"].is-active {
  color: var(--mod-dance);
  background: color-mix(in srgb, var(--mod-dance) 12%, transparent);
}
.tab[data-color="money"].is-active {
  color: var(--mod-money);
  background: color-mix(in srgb, var(--mod-money) 12%, transparent);
}
.tab[data-color="study"].is-active {
  color: var(--mod-study);
  background: color-mix(in srgb, var(--mod-study) 12%, transparent);
}

.tab:active {
  transform: scale(0.94);
}

/* Stagger home entrance */
.home-anim > * {
  animation: rise 0.55s var(--ease-out) both;
}

.home-anim > *:nth-child(1) {
  animation-delay: 0.02s;
}
.home-anim > *:nth-child(2) {
  animation-delay: 0.07s;
}
.home-anim > *:nth-child(3) {
  animation-delay: 0.12s;
}
.home-anim > *:nth-child(4) {
  animation-delay: 0.18s;
}
.home-anim > *:nth-child(5) {
  animation-delay: 0.24s;
}
.home-anim > *:nth-child(6) {
  animation-delay: 0.3s;
}

.tile-grid.home-anim .tile:nth-child(1) {
  animation-delay: 0.22s;
}
.tile-grid.home-anim .tile:nth-child(2) {
  animation-delay: 0.27s;
}
.tile-grid.home-anim .tile:nth-child(3) {
  animation-delay: 0.32s;
}
.tile-grid.home-anim .tile:nth-child(4) {
  animation-delay: 0.37s;
}
.tile-grid.home-anim .tile:nth-child(5) {
  animation-delay: 0.42s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .home-anim > *,
  .tile-grid.home-anim .tile,
  .ring-fg {
    animation: none !important;
    transition: none !important;
  }
  .view-layer.is-animating {
    transition: none !important;
  }
}

/* Desktop preview nicety */
@media (min-width: 520px) {
  .app {
    max-width: 430px;
    margin: 0 auto;
    box-shadow: var(--shadow);
  }
  .ambient {
    background: var(--bg-deep);
  }
  .tabbar {
    left: max(12px, calc(50% - 215px + 12px));
    right: max(12px, calc(50% - 215px + 12px));
  }
}
