/* The result sheet: a commemorative ticket (記念乗車券) with a tear-off stub, notches on the
   perforation, a red serial number and a rank stamp. */
.report {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--ground);
  color: var(--ink);
  overflow-y: auto;
}
.report::backdrop {
  background:
    radial-gradient(circle, rgb(255 255 255 / 0.1) 0 0.9px, transparent 1.3px) 0 0 / 5px 5px,
    rgb(29 34 51 / 0.62);
}
.report[open] { animation: rise 0.28s ease both; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.report-inner { padding: 18px clamp(12px, 4vw, 26px) 22px; }
.report-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.report-top h2 { margin: 0; font-size: 1.05rem; }
.report-close { min-height: 36px; padding: 0.3rem 0.8rem; }

.ticket {
  --stub: 44px;
  --notch: 10px;
  --pad: clamp(16px, 5vw, 26px);
  position: relative;
  overflow: hidden; /* the stamp lands from 1.9× scale; keep it from widening the dialog */
  margin-top: 14px;
  background:
    radial-gradient(circle, rgb(32 110 100 / 0.13) 0 0.8px, transparent 1.2px) 0 0 / 4px 4px,
    var(--ticket);
  border-radius: 4px;
  -webkit-mask:
    radial-gradient(circle at 0 calc(100% - var(--stub)), transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% calc(100% - var(--stub)), transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 calc(100% - var(--stub)), transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% calc(100% - var(--stub)), transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
}

.ticket-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px var(--pad) 9px;
  border-bottom: 1px solid rgb(29 34 51 / 0.22);
  font-size: 0.82rem; font-weight: 700; white-space: nowrap;
}
.ticket-kind { padding: 0 6px; border: 1px solid currentColor; border-radius: 2px; font-size: 0.74rem; }
.ticket-no { margin-left: auto; font: 400 0.95rem var(--font-dot); color: var(--stamp); letter-spacing: 0.04em; }

.ticket-body { position: relative; padding: 12px var(--pad) 18px; }

.ticket-score { margin: 0; display: flex; align-items: baseline; gap: 6px; }
.ticket-score strong { font: 400 clamp(3.2rem, 2.4rem + 4vw, 4.4rem)/0.95 var(--font-display); }
.ticket-score span { font-weight: 700; color: var(--ink-soft); }

.ticket-rank { margin: 10px 0 0; padding-right: 118px; font: 400 1.55rem/1.2 var(--font-display); font-feature-settings: "palt"; }
.ticket-quip { margin: 6px 0 0; padding-right: 100px; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.6; text-wrap: balance; }

/* Ruled fields, as printed on a 乗車券 — not dashboard cards. */
.ticket-meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0 0;
  border-block: 1px solid rgb(29 34 51 / 0.3);
}
.ticket-meta div { padding: 6px 12px; }
.ticket-meta div + div { border-left: 1px solid rgb(29 34 51 / 0.3); }
.ticket-meta div:first-child { padding-left: 0; }
.ticket-meta dt { font-size: 0.74rem; color: var(--ink-soft); white-space: nowrap; }
.ticket-meta dd { margin: 0; font: 700 1.15rem/1.3 var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }

.ticket-route { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 0; font-weight: 700; }
.ticket-label { padding: 0 6px; border: 1px solid currentColor; border-radius: 2px; font-size: 0.72rem; color: var(--ink-soft); }

.ticket-lines { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.ticket-lines li { display: flex; align-items: center; gap: 4px; font: 600 0.8rem var(--font-num); font-variant-numeric: tabular-nums; }

.ticket .stamp { top: 10px; right: 16px; width: 116px; }

.ticket-stub {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--stub);
  padding: 0 var(--pad);
  border-top: 1.5px dashed rgb(29 34 51 / 0.38);
  font-size: 0.78rem; font-weight: 700; white-space: nowrap; overflow: hidden;
}
.ticket-tag { overflow: hidden; text-overflow: ellipsis; }
.ticket-valid { color: var(--ink-soft); font-weight: 600; }
.ticket-date { margin-left: 6px; font-family: var(--font-dot); color: var(--ink); }

.share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.share .btn { flex: 1 1 auto; white-space: nowrap; }

.insight { margin-top: 18px; }
.insight h3 { margin: 0 0 6px; font-size: 0.9rem; }
.insight ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.insight li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; background: var(--surface); border-radius: 2px; }
.insight li span:first-child { font-weight: 700; }
.insight .rate { color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; }

.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); }

@media (max-width: 520px) {
  .ticket-rank, .ticket-quip { padding-right: 0; }
  .ticket-rank { padding-right: 76px; }
  .ticket .stamp { top: 6px; right: 8px; width: 82px; }
  .ticket-meta div { padding: 5px 8px; }
  .ticket-meta dd { font-size: 1rem; }
  .ticket-valid { display: none; }
}

@media (max-width: 400px) {
  .ticket-title { display: none; }
}
