* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-0: #f6f2e8;
  --bg-1: #ffffff;
  --bg-2: rgba(255,255,255,0.85);
  --line: rgba(20,30,50,0.10);
  --gold: #e89c00;
  --gold-hi: #d97a00;
  --mint: #1d9d7c;
  --coral: #e63946;
  --coral-hi: #ff4d5c;
  --ink: #1a1f2b;
  --dim: #6b7280;
}

html, body { height: 100%; font-family: "Zen Kaku Gothic New", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif; background: var(--bg-0); color: var(--ink); overflow: hidden; letter-spacing: 0.02em; }
body {
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(230,57,70,0.10), transparent 55%),
    radial-gradient(1000px 500px at 85% 100%, rgba(29,157,124,0.10), transparent 55%),
    linear-gradient(180deg, #fbf7ea 0%, #f2ede0 100%);
  position: relative;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(rgba(20,30,50,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,30,50,0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 90%);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(246,242,232,0.5) 100%);
}

#bg-slideshow { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.bg-slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 2s ease-in-out;
  filter: blur(2px) saturate(1.3) brightness(1.1);
  transform: scale(1.1);
  animation: kenburns 20s ease-in-out infinite alternate;
}
.bg-slide.active { opacity: 1; }
@keyframes kenburns {
  0%   { transform: scale(1.1) translate(0, 0); }
  100% { transform: scale(1.25) translate(-2%, -2%); }
}

#app { z-index: 2; }

#app { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100vh; padding: 2.5vh 3vw; gap: 2vh; }

header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5vh;
}
.brand {
  font-family: "Zen Kaku Gothic New", "Bebas Neue", sans-serif;
  font-size: 4.5vh; font-weight: 900; letter-spacing: 0.05em;
  color: #1a1f2b;
  text-shadow: 0 2px 8px rgba(255,255,255,0.6);
}
.deadline {
  font-size: 2.5vh; color: #0f7a5f; font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 0.8vh 1.8vw; border: 1.5px solid rgba(15,122,95,0.30); border-radius: 999px;
  background: rgba(255,255,255,0.85);
}
header nav { display: flex; gap: 2vw; }

nav a {
  color: var(--mint); text-decoration: none; font-size: 2.2vh;
  padding: 0.6vh 1.4vw; border: 1px solid var(--line); border-radius: 999px;
  transition: all 0.15s ease;
}
nav a:hover { background: rgba(143,255,210,0.08); border-color: var(--mint); }

main { flex: 1; display: grid; grid-template-columns: 2fr 1.2fr; grid-template-rows: 2fr 1fr; gap: 2vh; min-height: 0; }

.stat {
  position: relative; overflow: hidden;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1.5px solid rgba(20,30,50,0.12); border-radius: 2.5vh;
  padding: 3vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  box-shadow: 0 20px 40px rgba(20,30,50,0.18), 0 0 0 1px rgba(255,255,255,0.6) inset;
}
.stat::after {
  content: ""; position: absolute; inset: -1px; border-radius: 2.5vh; pointer-events: none;
  background: radial-gradient(300px 120px at 50% 0%, rgba(255,209,102,0.15), transparent 70%);
}
.stat .label {
  font-size: 2vh; color: #4a5568; margin-bottom: 1vh;
  letter-spacing: 0.2em; font-weight: 700;
}
.stat .value {
  font-size: 14vh; font-weight: 800; line-height: 0.95; color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "SF Pro Display", -apple-system, monospace;
  letter-spacing: -0.03em;
}
.deadline { font-family: "JetBrains Mono", monospace; font-weight: 600; }
footer { font-family: "JetBrains Mono", monospace; }
.hr-time, .hr-total, .hr-per, .hr-count, .hr-delta { font-family: "JetBrains Mono", monospace; }
#items li .time, #items li .price { font-family: "JetBrains Mono", monospace; }
.album-cell .ts { font-family: "JetBrains Mono", monospace; }
.stat .unit { font-size: 4vh; margin-left: 0.7vw; color: var(--dim); font-weight: 400; letter-spacing: 0.05em; }
.stat .sub { font-size: 1.8vh; color: var(--coral); margin-top: 1vh; letter-spacing: 0.05em; }

.total { grid-column: 1; grid-row: 1 / span 2; }
.total .value { color: #b95e00; -webkit-text-stroke: 1px rgba(0,0,0,0.05); text-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.per   { grid-column: 2; grid-row: 1; }
.per .value { color: #0f7a5f; font-size: 10vh; text-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.count { grid-column: 2; grid-row: 2; }
.count .value { font-size: 8vh; color: #c62430; text-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.items { grid-column: 1 / span 2; background: rgba(255,255,255,0.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1.5px solid rgba(20,30,50,0.12); border-radius: 2vh; padding: 2vh 2.5vh; display: none; }
.items-title { font-size: 1.9vh; color: #4a5568; margin-bottom: 1vh; letter-spacing: 0.2em; font-weight: 700; }
#items { list-style: none; display: flex; flex-direction: column; gap: 0.6vh; }
#items li { display: flex; justify-content: space-between; font-size: 2.3vh; color: #1a1f2b; padding: 0.6vh 0; border-bottom: 1px dashed rgba(20,30,50,0.10); font-weight: 500; }
#items li:last-child { border-bottom: none; }
#items li .time { color: #6b7280; margin-right: 1vw; font-variant-numeric: tabular-nums; font-weight: 600; }
#items li .name { flex: 1; }
#items li .qty { color: #0f7a5f; margin: 0 1vw; font-weight: 800; }
#items li .price { color: #b95e00; font-variant-numeric: tabular-nums; font-weight: 700; }
#items li.cancelled .name, #items li.cancelled .qty, #items li.cancelled .price { text-decoration: line-through; opacity: 0.35; }
#items li.cancelled .name::after { content: " [キャンセル]"; color: var(--coral); opacity: 0.9; text-decoration: none; margin-left: 0.5vw; }

footer {
  display: flex; justify-content: space-between; font-size: 2vh; color: var(--dim);
  border-top: 1px solid var(--line); padding-top: 1vh; font-variant-numeric: tabular-nums;
}

#cutin {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(6,8,12,0.85), rgba(6,8,12,0.98)); z-index: 999;
  animation: cutin-in 0.4s cubic-bezier(0.2,1.6,0.4,1) forwards;
  cursor: pointer;
}
#cutin-queue { position: absolute; top: 2vh; left: 2vw; padding: 1vh 2vw; background: rgba(0,0,0,0.6); border-radius: 999px; color: #ffe066; font-family: "JetBrains Mono", monospace; font-size: 2vh; }
#cutin-hint { position: absolute; bottom: 2vh; color: rgba(255,255,255,0.5); font-size: 1.8vh; letter-spacing: 0.1em; }
#cutin.hidden { display: none; }
#cutin-img {
  max-width: 60vw; max-height: 60vh; border-radius: 3vh;
  box-shadow: 0 0 80px var(--gold), 0 0 160px var(--coral), 0 20px 60px rgba(0,0,0,0.6);
  animation: cutin-img 0.6s cubic-bezier(0.2,1.6,0.4,1) forwards;
  border: 2px solid rgba(255,255,255,0.1);
}
#cutin-text {
  font-size: 6vh; color: var(--gold-hi); font-weight: 900; margin-top: 3vh;
  text-shadow: 0 0 30px var(--coral), 0 0 60px rgba(255,209,102,0.5);
  text-align: center; letter-spacing: 0.08em;
}
@keyframes cutin-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cutin-img { from { transform: scale(0.3) rotate(-8deg); } to { transform: scale(1) rotate(0); } }

#audio-unlock {
  position: fixed; bottom: 2vh; right: 2vw;
  padding: 1.4vh 2vw; background: linear-gradient(135deg, var(--mint), #6eeab6);
  color: var(--bg-0); border: none; border-radius: 999px;
  font-size: 2vh; font-weight: 800; z-index: 1000; cursor: pointer;
  box-shadow: 0 10px 30px rgba(143,255,210,0.35);
  letter-spacing: 0.05em;
}
#audio-unlock:hover { transform: translateY(-2px); }

/* --- album / history 共通 --- */
body.page-album, body.page-history { overflow: auto; }
.album, .history { padding: 3vh 3vw; }
.album { max-width: 1600px; margin: 0 auto; }
.history { max-width: 1200px; margin: 0 auto; }

#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2vh; }
.album-cell {
  background: transparent;
  border-radius: 2vh;
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 30px rgba(20,30,50,0.15);
}
.album-cell:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(20,30,50,0.30); }
.album-cell img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.album-cell .cap { position: absolute; bottom: 0; left: 0; right: 0; padding: 1.2vh 1.5vh; color: #fff; font-size: 2vh; font-weight: 700; letter-spacing: 0.03em; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75)); }
.album-cell .ts { position: absolute; top: 1vh; right: 1vh; background: rgba(0,0,0,0.55); padding: 0.5vh 1vh; border-radius: 1vh; color: #ffe066; font-size: 1.6vh; font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }

#list { display: flex; flex-direction: column; gap: 1vh; }
.history-row {
  display: grid; grid-template-columns: 100px 2fr 2fr 1fr 1.5fr; gap: 2vw;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(14px);
  border: 1px solid rgba(20,30,50,0.08);
  padding: 2vh; border-radius: 1.5vh; font-size: 2.5vh; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.hr-time { color: var(--dim); }
.hr-total { color: var(--gold-hi); font-weight: 700; }
.hr-per { color: var(--mint); }
.hr-count { color: var(--coral); }
.hr-delta { color: var(--mint); text-align: right; }

/* --- スマホ縦画面対応 --- */
@media (orientation: portrait), (max-width: 640px) {
  html, body { overflow: auto; }
  #app { height: auto; min-height: 100vh; padding: 2vh 4vw; gap: 1.5vh; }
  header { flex-wrap: wrap; gap: 1vh; }
  .brand { font-size: 3.2vh; }
  .deadline { font-size: 2vh; padding: 0.5vh 3vw; }
  nav { font-size: 1.8vh; gap: 2vw; flex-wrap: wrap; }
  nav a { padding: 0.5vh 3vw; }

  main { display: flex; flex-direction: column; grid-template-columns: none; grid-template-rows: none; gap: 1.5vh; }
  .stat { padding: 2vh 1.5vh; }
  .stat .label { font-size: 1.5vh; margin-bottom: 0.6vh; letter-spacing: 0.2em; }
  .total .value { font-size: 10vh; }
  .per .value { font-size: 7vh; }
  .count .value { font-size: 6vh; }
  .stat .unit { font-size: 3vh; }
  .items { display: block; }

  #items li { font-size: 1.8vh; flex-wrap: wrap; }
  #cutin-img { max-width: 85vw; max-height: 45vh; }
  #cutin-text { font-size: 3.5vh; }

  #audio-unlock { bottom: 1vh; right: 3vw; font-size: 1.6vh; padding: 1vh 4vw; }

  .history-row { grid-template-columns: 60px 1fr 1fr; grid-template-rows: auto auto; font-size: 1.8vh; padding: 1.5vh; gap: 1vw 3vw; }
  .hr-time { grid-column: 1; grid-row: 1 / span 2; }
  .hr-total { grid-column: 2; grid-row: 1; }
  .hr-per { grid-column: 3; grid-row: 1; text-align: right; }
  .hr-count { grid-column: 2; grid-row: 2; }
  .hr-delta { grid-column: 3; grid-row: 2; }

  #grid { grid-template-columns: repeat(2, 1fr); gap: 1.5vh; }
  .album-cell .cap { font-size: 1.6vh; padding: 0.8vh 1vh; }
  .album-cell .ts { font-size: 1.3vh; }
}
