:root {
  --ink: #000;
  --orange: #F29900;
  --ig: #A64D78;
  --snap: #3D5A80;
  --good: #A9D18E;
  --bad: #FFCCCC;
  --grey: #D9D9D9;
  --pink: #FFF1F7;
  --hot: #EAD1DC;
  --total: #D0D0D0;
  --card: #FFF8FB;
  --card-line: #C7A4B4;
  --link: #1155CC;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #fff; color: var(--ink); }
body { font: 16px/1.15 "EB Garamond", "Times New Roman", serif; }
button, input { font: inherit; }
a { color: var(--link); text-decoration: underline; }

.hold { min-height: 100vh; display: grid; place-items: center; background: #fff; color: #17324d; font-size: 22px; font-weight: 600; }
.hold[hidden] { display: none; }
.gate { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; background: #f6f4ef; color: #17181a; font-family: "IBM Plex Sans", system-ui, sans-serif; }
.gate .scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; perspective: 900px; }
.gate .scene-light { z-index: 0; }
.gate .floor {
  position: absolute; left: -40%; width: 180%; height: 62%; bottom: -6%;
  background-image:
    linear-gradient(rgba(217, 84, 43, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 24, 26, .14) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotateX(68deg);
  transform-origin: center top;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 78%);
  mask-image: linear-gradient(to top, #000 10%, transparent 78%);
}
.gate .orb {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 8%, #f0b39a 28%, rgba(217, 84, 43, .15) 62%, transparent 72%);
  filter: blur(1px);
}
.gate .scene-light .orb:nth-child(2) { width: 180px; height: 180px; left: 8%; top: 18%; opacity: .55; }
.gate .scene-light .orb:nth-child(3) { width: 120px; height: 120px; right: 18%; bottom: 22%; opacity: .4; }
.gate .scene-light .orb:nth-child(4) { width: 70px; height: 70px; left: 42%; top: 58%; opacity: .5; }
.gate .scene-dark { z-index: 0; }
.gate .scene-dark .floor {
  background-image:
    linear-gradient(rgba(217, 84, 43, .45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .14) 1px, transparent 1px);
}
.gate .scene-dark .orb { background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.7) 0 6%, rgba(217, 84, 43, .55) 30%, transparent 68%); }
.gate .scene-dark .orb:nth-child(2) { width: 220px; height: 220px; right: 8%; top: 10%; opacity: .7; }
.gate .scene-dark .orb:nth-child(3) { width: 140px; height: 140px; left: 6%; bottom: 16%; opacity: .55; }
.gate .scene-dark .orb:nth-child(4) { width: 90px; height: 90px; right: 30%; bottom: 28%; opacity: .45; }
.gate[hidden], #app[hidden] { display: none; }
.gate .auth { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 40px clamp(24px, 5vw, 72px); min-height: 100vh; }
.gate .logo { display: flex; align-items: center; gap: 10px; }
.gate .logo-mark { width: 32px; height: 32px; border-radius: 8px; background: #17181a; color: #f6f4ef; display: grid; place-items: center; font-weight: 600; font-size: 12px; letter-spacing: .04em; }
.gate .logo-text { font-weight: 600; font-size: 15px; }
.gate .logo-text span { color: #85878b; font-weight: 400; }
.gate .auth-body { max-width: 380px; width: 100%; }
.gate .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #4a4c50; padding: 5px 10px 5px 8px; border: 1px solid #e2ded5; border-radius: 6px; background: #fff; }
.gate .eyebrow svg { width: 14px; height: 14px; }
.gate h1 { margin: 28px 0 0; text-align: left; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -.025em; color: #17181a; }
.gate .sub { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: #4a4c50; }
.gate .gsi {
  margin-top: 32px; width: 100%; height: 48px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 8px;
  font-family: Roboto, "IBM Plex Sans", sans-serif; font-weight: 500; font-size: 15px;
}
.gate .gsi:hover { background: #f8f9fa; box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); }
.gate .gsi:disabled { opacity: .6; cursor: progress; }
.gate .gsi .g { width: 18px; height: 18px; flex: none; }
.gate .note { margin: 16px 0 0; font-size: 13px; line-height: 1.55; color: #85878b; display: flex; gap: 8px; }
.gate .note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.gate .error { margin-top: 16px; padding: 10px 12px; border-radius: 6px; font-size: 13px; background: #fbeee9; color: #8a2f14; border: 1px solid #f0cfc2; }
.gate .error[hidden] { display: none; }
.gate .auth-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #85878b; }
.gate .preview { position: relative; z-index: 1; background: #141517; color: #ecebe7; display: flex; flex-direction: column; justify-content: center; padding: 48px 0 48px clamp(28px, 4vw, 64px); overflow: hidden; }
.gate .preview-head, .gate .device { position: relative; z-index: 1; }
.gate .preview-head { max-width: 520px; margin-bottom: 28px; padding-right: 24px; }
.gate .preview-head h2 { font-size: 22px; line-height: 1.4; font-weight: 500; letter-spacing: -.015em; }
.gate .preview-head h2 span { color: #6e6f6c; }
.gate .preview { align-items: center; }
.gate .device { height: min(680px, 78%); width: auto; aspect-ratio: 9 / 19.2; border-radius: 42px; padding: 10px; background: linear-gradient(160deg, #8d7aa3, #5c4b73 42%, #3d3150); box-shadow: 0 30px 60px -24px rgba(0,0,0,.55); }
.gate .device-screen { position: relative; height: 100%; border-radius: 32px; overflow: hidden; background: #111; color: #fff; }
.gate .device-screen img#reel-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.gate .device-screen::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.28) 0 14%, transparent 28% 62%, rgba(0,0,0,.62) 100%); pointer-events: none; }
.gate .reel-top, .gate .reel-actions, .gate .reel-foot { position: absolute; z-index: 1; }
.gate .reel-top { top: 16px; left: 14px; right: 14px; display: flex; justify-content: space-between; }
.gate .reel-top svg, .gate .reel-actions svg, .gate .reel-audio svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.gate .reel-actions { right: 12px; bottom: 108px; display: grid; gap: 16px; justify-items: center; font-size: 12px; font-weight: 600; }
.gate .reel-actions div { display: grid; justify-items: center; gap: 4px; }
.gate .reel-foot { left: 14px; right: 58px; bottom: 18px; }
.gate .reel-id { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.gate .reel-id img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,.7); }
.gate .follow { margin-left: 4px; padding: 3px 10px; border: 1px solid #fff; border-radius: 6px; font-size: 12px; font-weight: 500; }
.gate .reel-audio { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.gate .reel-audio svg { width: 14px; height: 14px; }
.gate #reel-caption { margin: 6px 0 0; font-size: 12.5px; line-height: 1.35; }
@media (max-height: 820px) and (min-width: 901px) {
  .gate .preview-head { display: none; }
  .gate .device { height: min(620px, 86%); }
}
@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; background: #f7f5f2; }
  .gate .auth { min-height: 0; padding: 14px 18px 0; }
  .gate .auth-body { margin: 12px 0 6px; }
  .gate .sub { display: none; }
  .gate .auth-foot { display: none; }
  .gate h1 { margin-top: 12px; font-size: 24px; }
  .gate .gsi { margin-top: 14px; height: 48px; font-size: 16px; }
  .gate .note { margin-top: 8px; }
  .gate .preview { background: transparent; padding: 8px 12px 16px; }
  .gate .scene-dark { display: none; }
  .gate .preview-head { display: none; }
  .gate .device { height: auto; width: min(268px, 72vw); box-shadow: 0 24px 40px -18px rgba(60, 40, 80, .35); }
}
@media (max-width: 420px) {
  .gate .auth { padding: 22px 16px 18px; }
  .gate .logo-text { font-size: 14px; }
  .gate h1 { font-size: 26px; }
  .gate .auth-foot { flex-direction: column; gap: 6px; }
}

.sheet { width: 100%; min-height: 100vh; padding: 18px 22px 56px; }
.conf { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 16px; }
.who { display: flex; align-items: baseline; gap: 12px; }
.who button { border: 1px solid #000; background: #fff; padding: 2px 8px; font-size: 14px; }
h1 { margin: 28px 0 6px; text-align: center; font-size: 21px; font-weight: 700; }
.period { margin: 0 0 10px; text-align: center; font-size: 19px; font-weight: 700; }
.range { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; align-items: end; margin: 0 0 18px; }
.range label { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 700; }
.range input { border: 1px solid #000; padding: 4px 6px; background: #fff; }
.range button { background: var(--orange); color: #000; border: 1px solid #000; font-weight: 700; padding: 6px 12px; }

h2.sec { margin: 18px 0 8px; font-size: 19px; font-weight: 700; }
h2.sec.later { margin-top: 22px; }
h3.sub { margin: 12px 0 6px; font-size: 16px; font-weight: 700; }
.ov { margin: 0 0 6px; padding-left: 28px; text-indent: -22px; }
.note { margin: 4px 0 8px; font-size: 15px; }
.fine { margin: 6px 0 0; font-size: 12px; font-style: italic; }
.empty { margin: 12px 0; }

table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0 0 8px; }
table.grid th, table.grid td {
  border: 1px solid #000; padding: 4px 4px; text-align: center; vertical-align: middle;
  font-size: 13px; overflow-wrap: anywhere;
}
table.grid thead th { white-space: normal; line-height: 1.15; }
table.grid .band th { background: var(--orange); color: #000; font-size: 16px; font-weight: 700; padding: 6px; white-space: normal; }
table.grid thead th.ig, td.ig { background: var(--ig); color: #fff; font-weight: 700; }
table.grid thead th.snap { background: var(--snap); color: #fff; font-weight: 700; }
td.good { background: var(--good); }
td.bad { background: var(--bad); }
td.idle { background: var(--grey); }
td.pink { background: var(--pink); }
td.hot { background: var(--hot); }
td.sum { background: var(--total); font-weight: 700; }
.name a { font-weight: 700; }
.handle { font-weight: 400; font-size: 11px; color: #000; }

.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; width: 100%; border: 1px solid var(--card-line); }
.reel { background: var(--card); border-right: 1px solid var(--card-line); text-align: center; padding: 0 0 12px; }
.reel:last-child { border-right: 0; }
.reel .rank { background: var(--ig); color: #fff; font-weight: 700; padding: 6px; }
.shot { display: block; width: 168px; height: 298px; margin: 14px auto 4px; border-radius: 28px; overflow: hidden; background: #f3e8ee; }
.shot img { width: 168px; height: 298px; object-fit: cover; object-position: center; display: block; border-radius: 28px; }
.reel .page { margin: 10px 0 2px; font-weight: 700; font-size: 15px; }
.reel .views { font-weight: 700; font-size: 17px; }
.reel .open { font-size: 12px; }
.reels-band { background: var(--orange); text-align: center; font-weight: 700; font-size: 16px; padding: 6px; border: 1px solid #000; border-bottom: 0; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  #gate, #hold, .who, .range { display: none !important; }
  .sheet { padding: 0; min-height: 0; }
  body, .sheet, table.grid th, table.grid td, .reels, .reel, .reels-band {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.grid tr, .reel { break-inside: avoid; }
  h2.sec { break-after: avoid; }
  .reels { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; }
  .reel { border-right: 1px solid var(--card-line) !important; border-bottom: 0 !important; }
  .shot, .shot img {
    width: 38mm !important;
    height: 68mm !important;
    max-width: 38mm !important;
    max-height: 68mm !important;
    object-fit: cover !important;
    object-position: center !important;
  }
}
@media (max-width: 800px) {
  .reels { grid-template-columns: 1fr; }
  .reel { border-right: 0; border-bottom: 1px solid var(--card-line); }
}
