@font-face { font-family: 'ITC Avant Garde Gothic Std Extra Light'; src: url('fonts/ITC Avant Garde Gothic Std Extra Light.woff2') format('woff2'); }
@font-face { font-family: 'AR ADGothicJP'; src: url('fonts/jadhei01m.woff2') format('woff2'); }
@font-face { font-family: 'KozGoPr6N'; src: url('fonts/KozGoPr6N-Medium.woff2') format('woff2'); }

:root {
  --tool48-primary: #F676A6;
  --tool48-primary-hover: #E55A8C;
  --tool48-account-bg: rgba(255, 255, 255, 0.58);
  --tool48-account-border: rgba(255, 255, 255, 0.6);
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --ink: #172033;
  --muted: #667085;
  --line: rgba(255, 255, 255, 0.55);
  --danger: #d92d20;
  --shadow: 0 24px 80px rgba(76, 29, 77, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --safe-x: max(18px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { color: var(--ink); font-family: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans SC', 'Microsoft YaHei', 'KozGoPr6N', 'AR ADGothicJP', 'Noto Sans JP', sans-serif; font-size: 15px; line-height: 1.46; }
button, select, input, label { font: inherit; }
button, .language-select, .file-button { flex-shrink: 0; white-space: nowrap; }
input, select { min-width: 0; }

.bg-orb {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.26;
  pointer-events: none;
  z-index: -1;
  display: none;
}
.orb-a { top: 8vh; left: -120px; background: #ff4f9a; }
.orb-b { right: -160px; bottom: 4vh; background: #5bd6ff; }

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 14px;
  z-index: 20;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 52px rgba(31, 41, 55, 0.12), inset 0 1px 0 rgba(255,255,255,0.78);
}
.tool48-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.74);
  color: var(--tool48-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(255,79,154,0.14);
  flex: 0 0 auto;
}
.tool48-home-link:hover { color: var(--tool48-primary-hover); background: rgba(255,255,255,0.92); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  flex: 1 1 auto;
}
.brand > span:last-child { min-width: 0; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--tool48-primary), var(--tool48-primary-hover));
  box-shadow: 0 12px 34px rgba(246, 118, 166, 0.25);
}
.brand strong { display: block; font-size: 16px; line-height: 1.15; }
.brand strong, .brand em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 3px; }
.topbar-actions {
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
}
.language-select {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.86);
  background-color: rgba(255,255,255,0.76);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 34px 10px 14px;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
  background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
  padding-bottom: 34px;
}
.hero {
  padding: clamp(14px, 2vw, 22px);
  min-height: 0;
  display: block;
  background: rgba(255,255,255,0.34);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tool48-primary-hover);
  font-size: 12px;
}
.hero h1 {
  max-width: 1040px;
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: 0;
}
.hero p:not(.eyebrow) {
  max-width: 920px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-meter, .hero-chip, .hero-bubble { display: none !important; }

.tab-nav {
  margin: 14px 0;
  padding: 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: rgba(255,255,255,0.34);
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-button {
  border: 0;
  border-radius: 18px;
  padding: 11px 20px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}
.tab-button.active {
  color: #fff;
  background: linear-gradient(135deg, #ff4f9a, #ff8a4c);
  box-shadow: 0 14px 32px rgba(255, 79, 154, 0.22);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 18px;
  align-items: start;
}
.control-card, .preview-card, .records-card, .stats-card {
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255,255,255,0.38);
  box-shadow: var(--shadow);
}
.preview-card { overflow: hidden; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.section-head.compact { margin-bottom: 14px; }
.section-head h2 {
  margin: 0;
  font-size: clamp(22px, 2.7vw, 31px);
  letter-spacing: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.field {
  display: grid;
  grid-template-rows: auto 44px minmax(18px, auto);
  gap: 6px;
  min-width: 0;
}
.field.wide { grid-column: 1 / -1; }
.field[hidden] { display: none !important; }
.custom-performance-field { grid-column: 1 / -1 !important; }
.field span, .public-consent strong {
  font-weight: 900;
  font-size: 12px;
  color: #344054;
  line-height: 1.25;
}
.field input, .field select, .readonly-field output {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.74);
  border-radius: 14px;
  background: rgba(255,255,255,0.66);
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 10px 24px rgba(15,23,42,0.05);
}
.field input:focus, .field select:focus {
  border-color: rgba(255, 79, 154, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 79, 154, 0.13);
}
.readonly-field output {
  display: flex;
  align-items: center;
  font-weight: 900;
  font-size: 17px;
}
.field small, .readonly-field small, .public-consent small, .server-note, .safari-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.34;
}
.public-consent {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,0.52);
  border: 1px solid rgba(255,255,255,0.66);
}
.public-consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: #ff4f9a; }
.public-consent span { display: grid; gap: 4px; }
.form-actions, .records-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
button, .file-button {
  cursor: pointer;
  border: 0;
}
.primary-button, .secondary-button, .ghost-button, .danger-button, .file-button {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #ff4f9a, #ff8a4c);
  box-shadow: 0 16px 38px rgba(255, 79, 154, 0.22);
}
.secondary-button {
  color: #fff;
  background: linear-gradient(135deg, #6d5dfc, #38bdf8);
  box-shadow: 0 16px 38px rgba(56, 189, 248, 0.18);
}
.ghost-button, .file-button {
  color: var(--ink);
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(255,255,255,0.68);
}
.danger-button {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
}
.file-button input { display: none; }
.record-canvas {
  width: min(100%, 720px) !important;
  height: auto !important;
  max-height: min(68dvh, 820px);
  aspect-ratio: 3 / 4;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15,23,42,0.11);
}
.safari-note { margin: 14px 0 0; }

.record-list { display: grid; gap: 12px; }
.record-empty, .ranking-empty {
  padding: 24px;
  border-radius: 18px;
  background: rgba(255,255,255,0.52);
  color: var(--muted);
  text-align: center;
}
.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(255,255,255,0.66);
}
.record-main { min-width: 0; }
.record-title {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.record-meta span {
  background: rgba(255,255,255,0.64);
  border-radius: 999px;
  padding: 5px 9px;
}
.record-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.record-buttons button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  font-weight: 800;
}
.record-buttons .delete { color: #fff; background: #ef4444; }

.account-popover-shell {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.account-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 24px));
  max-height: calc(100dvh - 100px);
  overflow: auto;
  z-index: 60;
  margin: 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 22px 70px rgba(31, 41, 55, 0.18), inset 0 1px 0 rgba(255,255,255,0.78);
}

.account-popover[hidden] {
  display: none !important;
}

.cloud-panel {
  margin: 14px 0 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.54);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  display: grid;
  gap: 12px;
}

.account-link {
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--tool48-account-border);
  background: var(--tool48-account-bg);
  color: var(--tool48-primary);
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(246,118,166,0.14);
}

.account-link::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.account-popover.cloud-panel {
  margin: 0;
  background: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.86);
  z-index: 260;
  box-shadow: 0 24px 76px rgba(31, 41, 55, 0.22), inset 0 1px 0 rgba(255,255,255,0.82);
}

.cloud-copy h3 {
  margin: 4px 0;
  font-size: 18px;
}

.cloud-login-form,
.cloud-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.cloud-auth-button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 100%;
}

.cloud-auth-button-row .primary-button,
.cloud-auth-button-row .secondary-button {
  width: 100%;
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
  line-height: 1.1;
}

.tool48-reset-link {
  justify-self: start;
}

.cloud-email-field {
  min-width: min(280px, 100%);
  flex: 1 1 240px;
}

.cloud-actions[hidden],
.cloud-login-form[hidden],
[data-tool48-auth-unconfigured][hidden] {
  display: none !important;
}

.cloud-record-badge {
  border-color: rgba(56,189,248,0.45) !important;
  background: rgba(56,189,248,0.12) !important;
}

.public-threshold-note {
  grid-column: 1 / -1;
}

.account-shell {
  min-height: calc(100dvh - 180px);
  display: grid;
  align-items: start;
}

.account-card {
  width: min(720px, 100%);
  margin: 0 auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.kpi-card {
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(255,255,255,0.68);
  min-width: 0;
}
.kpi-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}
.kpi-card strong {
  display: block;
  font-size: 18px;
  margin-top: 5px;
  letter-spacing: -0.03em;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.chart-box, .ranking-grid article {
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(255,255,255,0.68);
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}
.chart-box h3, .ranking-grid h3 { margin: 0 0 8px; font-size: 14px; }
.chart-box canvas { width: 100%; height: auto; display: block; }
.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.ranking-list { display: grid; gap: 8px; }
.ranking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.66);
  padding: 8px 10px;
}
.ranking-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.ranking-row span:last-child { color: var(--muted); font-weight: 900; }
.member-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.heatmap-cell {
  min-height: 46px;
  border-radius: 12px;
  padding: 7px;
  color: #172033;
  background: rgba(255, 79, 154, var(--heat, 0.12));
  border: 1px solid rgba(255,255,255,0.65);
  display: grid;
  align-content: center;
  gap: 2px;
}
.heatmap-cell strong {
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.heatmap-cell small { color: var(--muted); font-weight: 900; }

.image-dialog {
  border: 0;
  width: min(520px, calc(100% - 26px));
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 28px 100px rgba(15,23,42,0.26);
}
.image-dialog::backdrop { background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(5px); }
.image-dialog h2 { margin: 0 0 6px; }
.image-dialog p { margin: 0 0 14px; color: var(--muted); line-height: 1.7; }
.image-dialog img {
  width: auto;
  max-width: 100%;
  max-height: calc(92dvh - 116px);
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(15,23,42,0.14);
}
.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  font-size: 24px;
  line-height: 1;
}
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  text-align: left;
  color: rgba(23,32,51,0.68);
  font-size: 12px;
  line-height: 1.7;
  background: rgba(255,255,255,0.46);
  border: 1px solid rgba(255,255,255,0.68);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(23,32,51,0.08);
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 6px; font-weight: 800; }
.footer-copy { min-width: 0; flex: 1 1 360px; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px 14px; flex: 0 0 auto; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 900; text-decoration: none; white-space: nowrap; }
.footer-link-icon { width: 14px; height: 14px; flex: 0 0 auto; background: currentColor; -webkit-mask: var(--footer-icon) center/contain no-repeat; mask: var(--footer-icon) center/contain no-repeat; }
.footer-link-icon-bug { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 2 1.9 1.9'/%3E%3Cpath d='M14.1 3.9 16 2'/%3E%3Cpath d='M9 7h6'/%3E%3Cpath d='M8 7v8a4 4 0 0 0 8 0V7'/%3E%3Cpath d='M3 13h4'/%3E%3Cpath d='M17 13h4'/%3E%3Cpath d='m5 19 3-3'/%3E%3Cpath d='m19 19-3-3'/%3E%3C/svg%3E"); }
.footer-link-icon-heart { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 21s-7.5-4.4-10-9.2C.3 8.5 2.3 4.5 6 4.2c2.1-.2 3.7.9 4.7 2.2.4.5 1 .5 1.4 0 1-1.3 2.6-2.4 4.7-2.2 3.7.3 5.7 4.3 4 7.6C19.5 16.6 12 21 12 21z'/%3E%3C/svg%3E"); }

@media (max-width: 980px) {
  .grid-layout, .chart-grid, .ranking-grid { grid-template-columns: 1fr; }
  .preview-card { order: initial; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 14px; line-height: 1.4; }
  .topbar { width: calc(100% - 22px); align-items: center; gap: 8px; padding: 8px; border-radius: 20px; }
  .tool48-home-link { min-height: 34px; padding: 6px 8px; font-size: 11px; }
  .brand { gap: 8px; min-width: 0; flex: 1 1 auto; }
  .brand em { display: none; }
  .brand strong { font-size: 13px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 14px; }
  .topbar-actions { gap: 6px; max-width: 52%; min-width: 0; }
  .language-select { max-width: 86px; padding-left: 10px; padding-right: 26px; font-size: 12px; }
  .account-link { width: 38px; max-width: 38px; min-width: 38px; min-height: 38px; padding: 0; gap: 0; font-size: 0; }
  .account-link::before { width: 16px; height: 16px; }
  .account-popover { position: fixed; top: 70px; right: 11px; left: 11px; width: auto; max-height: calc(100dvh - 86px); overflow: auto; }
  .account-popover .cloud-login-form,
  .account-popover .cloud-actions { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .account-popover .cloud-auth-button-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .account-popover .cloud-auth-button-row .primary-button,
  .account-popover .cloud-auth-button-row .secondary-button { min-height: 36px; padding-inline: 6px; font-size: 11px; }
  .account-popover .cloud-email-field { min-width: 0; }
  .app-shell { width: calc(100% - 22px); margin-top: 12px; }
  .hero { padding: 14px 16px; }
  .hero .eyebrow { margin-bottom: 6px; font-size: 11px; }
  .hero h1 { font-size: 22px; line-height: 1.12; }
  .hero p:not(.eyebrow) { font-size: 11.5px; line-height: 1.42; margin-top: 7px; -webkit-line-clamp: 2; }
  .tab-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; gap: 4px; margin: 10px 0; padding: 6px; }
  .tab-button { min-height: 36px; padding: 7px 3px; border-radius: 13px; white-space: nowrap; line-height: 1.1; font-size: 12px; }
  .control-card, .preview-card, .records-card, .stats-card { padding: 14px; border-radius: 22px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .field.wide { grid-column: auto; }
  .field { grid-template-rows: auto 40px minmax(16px, auto); gap: 5px; }
  .field span, .public-consent strong { font-size: 11px; }
  .field input, .field select, .readonly-field output { min-height: 40px; border-radius: 13px; padding: 0 10px; font-size: 12px; }
  .readonly-field small { display: none; }
  .public-consent { padding: 10px; margin-top: 10px; }
  .field small, .public-consent small { font-size: 10px; line-height: 1.32; }
  .section-head { flex-direction: column; }
  .records-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .record-item { grid-template-columns: 1fr; }
  .record-buttons { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .record-canvas { max-height: min(58dvh, 620px); border-radius: 18px; }
  .stats-card { padding: 12px; }
  .stats-card .section-head { gap: 8px; margin-bottom: 12px; }
  .stats-card .section-head h2 { font-size: 21px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .kpi-card { padding: 9px 10px; border-radius: 12px; }
  .kpi-card small { font-size: 11px; }
  .kpi-card strong { font-size: 16px; }
  .chart-grid, .ranking-grid { gap: 8px; }
  .chart-box, .ranking-grid article { padding: 10px; border-radius: 14px; }
  .member-heatmap { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
  .ranking-row { font-size: 12px; }
  .image-dialog { width: min(440px, calc(100% - 18px)); padding: 16px; }
  .site-footer {
    width: calc(100% - 22px);
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 10px;
    font-size: 0.6rem;
    line-height: 1.35;
  }
  .footer-copy { flex: 1 1 220px; }
  .footer-copy p { display: inline; }
  .footer-copy p + p { margin-top: 0; }
  .footer-copy p + p::before { content: " "; }
  .footer-links { width: auto; gap: 8px 10px; flex: 0 0 auto; }
  .footer-link-icon { width: 12px; height: 12px; }
}

/* =========================================
   Garapon Simulator
   ========================================= */
.simulator-card {
  padding: clamp(16px, 2.4vw, 24px);
  background: rgba(255,255,255,0.38);
  box-shadow: var(--shadow);
}
.sim-disclaimer {
  max-width: 440px;
  text-align: right;
}
.simulator-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: start;
}
.garapon-stage {
  min-height: 500px;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(255,255,255,0.62), rgba(255,255,255,0.28));
  border: 1px solid rgba(255,255,255,0.72);
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
}
.garapon-machine {
  position: relative;
  width: min(420px, 92vw);
  aspect-ratio: 1 / 1.02;
  --drum-rot: 0deg;
  --handle-rot: 0deg;
  touch-action: none;
}
.garapon-drum {
  position: absolute;
  left: 12%;
  top: 2%;
  width: 72%;
  aspect-ratio: 1;
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,0.38), transparent 26%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18) 0 18%, transparent 19% 100%),
    conic-gradient(from 12deg, rgba(111,68,26,0.16), transparent 12%, rgba(255,255,255,0.14) 24%, transparent 36%, rgba(111,68,26,0.16) 48%, transparent 62%, rgba(255,255,255,0.13) 76%, transparent 100%),
    repeating-linear-gradient(88deg, rgba(111,68,26,0.10) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #f2c17b, #e0a85f 54%, #b66c2f);
  border: 8px solid rgba(134,78,30,0.18);
  box-shadow: inset -22px -16px 28px rgba(101,56,20,0.18), inset 8px 8px 18px rgba(255,255,255,0.32), 0 24px 54px rgba(71,35,8,0.18);
  transform: rotate(var(--drum-rot));
  transition: transform 0.12s linear;
}
.drum-grain {
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  opacity: 0.18;
  background: repeating-radial-gradient(circle at 50% 50%, rgba(100,55,15,.36) 0 1px, transparent 1px 8px);
}
.drum-window {
  position: absolute;
  left: 27%;
  top: 27%;
  width: 46%;
  height: 46%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.54), rgba(255,255,255,0.18) 36%, rgba(116,69,22,0.08) 68%, rgba(74,42,12,0.14)),
    repeating-conic-gradient(from 8deg, rgba(255,255,255,0.16) 0 9deg, rgba(95,56,18,0.09) 9deg 18deg);
  border: 3px solid rgba(255,255,255,0.28);
  box-shadow: inset 0 0 0 10px rgba(255,255,255,0.07), inset -12px -16px 24px rgba(80,45,12,0.13), 0 8px 18px rgba(71,35,8,0.12);
}
.drum-window::before,
.drum-window::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}
.drum-window::before {
  width: 36%;
  height: 36%;
  background: radial-gradient(circle at 34% 28%, #fff, #d1d5db 46%, #64748b);
  box-shadow: 0 4px 10px rgba(15,23,42,0.18);
}
.drum-window::after {
  width: 86%;
  height: 86%;
  border: 1px solid rgba(255,255,255,0.34);
  box-shadow: inset 0 0 0 1px rgba(120,72,18,0.08);
}
.garapon-neck {
  position: absolute;
  left: 51%;
  top: 55%;
  width: 58px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d1d5db, #6b7280);
  transform: skewX(-6deg);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.5), 0 8px 14px rgba(15,23,42,.18);
  z-index: 5;
}
.garapon-stand {
  position: absolute;
  left: 28%;
  top: 48%;
  width: 42%;
  height: 40%;
  clip-path: polygon(46% 0, 60% 0, 100% 100%, 75% 100%, 68% 86%, 32% 86%, 25% 100%, 0 100%);
  background: linear-gradient(135deg, #f3f4f6, #9ca3af 58%, #e5e7eb);
  border: 1px solid rgba(75,85,99,.24);
  box-shadow: inset 8px 8px 10px rgba(255,255,255,.58), inset -8px -8px 12px rgba(55,65,81,.18), 0 14px 22px rgba(15,23,42,.18);
  z-index: 6;
}
.stand-hole {
  position: absolute;
  left: 50%;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.82);
  box-shadow: inset 2px 3px 7px rgba(75,85,99,.28);
}
.stand-hole.small { top: 22%; width: 20%; aspect-ratio: 1; }
.stand-hole.medium { top: 44%; width: 31%; aspect-ratio: 1; }
.stand-hole.large { top: 69%; width: 45%; aspect-ratio: 1.45 / 1; }
.garapon-handle {
  position: absolute;
  left: 54%;
  top: 50%;
  width: 126px;
  height: 126px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  transform: translate(-50%, -50%) rotate(var(--handle-rot));
  transform-origin: 50% 50%;
  cursor: grab;
  z-index: 9;
  touch-action: none;
}
.garapon-handle:active { cursor: grabbing; }
.garapon-handle::before {
  content: '';
  position: absolute;
  left: 47px;
  top: 47px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 28%, #fff, #cbd5e1 34%, #64748b 100%);
  box-shadow: 0 4px 8px rgba(15,23,42,.22);
}
.handle-arm {
  position: absolute;
  left: 62px;
  top: 58px;
  width: 72px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(#f8fafc, #94a3b8);
  box-shadow: 0 3px 7px rgba(15,23,42,.18);
  transform-origin: 0 50%;
}
.handle-knob {
  position: absolute;
  right: -6px;
  top: 51px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fff, #60a5fa 40%, #2563eb 100%);
  box-shadow: 0 5px 8px rgba(15,23,42,.22);
}
.garapon-base {
  position: absolute;
  left: 8%;
  bottom: 5%;
  width: 74%;
  height: 12%;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(120,72,18,0.08), transparent 25%, rgba(255,255,255,.16) 54%, rgba(120,72,18,.14)),
    repeating-linear-gradient(88deg, rgba(111,68,26,0.10) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #eab56c, #cf8e46);
  box-shadow: 0 16px 24px rgba(71,35,8,0.16);
  z-index: 3;
}
.garapon-tray {
  position: absolute;
  right: 4%;
  bottom: 6.5%;
  width: 27%;
  height: 13%;
  border-radius: 18px;
  background: linear-gradient(#fff, #f1f5f9);
  border: 1px solid rgba(148,163,184,.38);
  box-shadow: inset 0 -5px 8px rgba(148,163,184,.2), 0 10px 18px rgba(15,23,42,.12);
  z-index: 8;
}
.last-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0);
  background: #fff;
  box-shadow: inset -4px -5px 8px rgba(15,23,42,.18), 0 8px 14px rgba(15,23,42,.16);
}
.last-ball.show {
  animation: ballDrop .46s cubic-bezier(.2, .9, .2, 1) forwards;
}
.last-ball.red { background: #ef4444; }
.last-ball.green { background: #22c55e; }
.last-ball.white { background: #fff; }
@keyframes ballDrop {
  0% { transform: translate(-120%, -190%) scale(.3); opacity: 0; }
  62% { transform: translate(-50%, -28%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.sim-hint {
  margin: 14px 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
}
.sim-panel {
  display: grid;
  gap: 14px;
}
.sim-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stock-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset -3px -4px 7px rgba(15,23,42,.16), 0 5px 9px rgba(15,23,42,.12);
}
.stock-dot.red { background: #ef4444; }
.stock-dot.green { background: #22c55e; }
.sim-actions { display: flex; justify-content: flex-end; }
.sim-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sim-history-head h3 { margin: 0; font-size: 17px; }
.sim-history-head span { color: var(--muted); font-size: 12px; }
.sim-record-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 2px;
}
.sim-record-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(255,255,255,0.68);
}
.sim-record-row .stock-dot { width: 18px; height: 18px; }
.sim-record-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-record-row small { color: var(--muted); font-weight: 900; }
.sim-fast-pulse { animation: fastPulse .34s ease; }
@keyframes fastPulse { 0%, 100% { filter: none; } 50% { filter: saturate(1.5) brightness(1.08); } }

@media (max-width: 980px) {
  .simulator-layout { grid-template-columns: 1fr; }
  .garapon-stage { min-height: 470px; }
  .sim-disclaimer { text-align: left; max-width: none; }
}
@media (max-width: 640px) {
  .simulator-card { padding: 16px; border-radius: 22px; }
  .simulator-card .section-head { gap: 10px; margin-bottom: 14px; }
  .simulator-card .section-head h2 { font-size: 22px; }
  .sim-disclaimer { font-size: 11.5px; line-height: 1.45; }
  .garapon-stage { min-height: 390px; padding: 10px; }
  .garapon-machine { width: min(310px, 90vw); }
  .sim-hint { margin-top: 10px; font-size: 12.5px; }
  .sim-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-history-head { display: grid; }
  .sim-record-list { max-height: 300px; }
}
