:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --success: #059669;
  --success-soft: #d1fae5;
  --border: #e2e8f0;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body.auth {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #334155 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 10%, #1d4ed8 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.shell {
  width: 100%;
  max-width: 440px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

.brand h1 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand p {
  color: var(--muted);
  font-size: 0.85rem;
}

h2 {
  font-size: 1.65rem;
  line-height: 1.25;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.lead {
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
}

.google-btn:active {
  background: #f8f9fa;
}

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

.hint {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.alert {
  background: #fef3c7;
  color: #92400e;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 20px 0 24px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.user-row strong {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-all;
}

.logout {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
}

.logout:active {
  background: var(--accent-dark);
}

code {
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}

@media (min-width: 640px) {
  .card {
    padding: 40px 36px 32px;
  }
}

body.app {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #e2e8f0;
  color: var(--text);
  padding: 0;
}

.app-frame {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.app-kicker {
  color: var(--muted);
  font-size: 0.75rem;
}

.app-header h1 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.app-content {
  flex: 1;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 14px;
}

.success-panel h2 {
  font-size: 1.4rem;
}

.panel h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.action-grid {
  display: grid;
  gap: 10px;
}

.action-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
}

.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

.search-form button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 12px 14px;
}

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.result-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.result-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  row-gap: 2px;
  margin: 0;
}

.result-meta div {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.result-meta .result-desig {
  grid-column: 2 / -1;
  grid-template-columns: 4.6rem minmax(0, 1fr);
}

.result-meta dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.result-meta dd {
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.pay-btn {
  width: auto;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
}

.pay-btn:hover,
.pay-btn:focus-visible {
  background: var(--accent-dark);
}

a.pay-btn-link {
  display: inline-block;
  text-decoration: none;
  line-height: 1.2;
}

.match-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.match-acc {
  margin: 0;
}

.match-acc-bar {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 14px;
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: background 0.18s ease;
}

.match-acc-bar::-webkit-details-marker,
.match-acc-bar::marker {
  display: none;
  content: '';
}

.match-acc-bar:hover {
  background: #f8fafc;
}

.match-acc-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.match-acc-bar::after {
  content: '';
  width: 0.36rem;
  height: 0.36rem;
  margin-top: 10px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  justify-self: end;
}

.match-acc[open] > .match-acc-bar {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), #ffffff 48%);
  border-bottom: 1px solid var(--border);
}

.match-acc[open] > .match-acc-bar::after {
  transform: rotate(225deg);
}

.match-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: #e2e8f0;
  border: 1px solid var(--border);
}

.match-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  border: 0;
}

.match-acc-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.match-acc-top {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.match-acc-name {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-acc-desig {
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: break-word;
  word-break: break-word;
}

.match-acc-place {
  display: flex;
  min-width: 0;
  gap: 4px;
}

.match-chip {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-chip-zone {
  background: #ecfdf5;
  color: #065f46;
}

.match-acc-body {
  padding: 10px 12px 12px;
  background: #fff;
  animation: match-acc-open 0.2s ease;
}

@keyframes match-acc-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.match-section-label {
  margin: 10px 0 6px;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.match-acc-body > .match-section-label:first-child {
  margin-top: 0;
}

.match-meta {
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  row-gap: 6px;
}

.match-meta + .match-section-label {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.match-meta div {
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
}

.match-meta .match-span {
  grid-column: 1 / -1;
}

.match-meta dt {
  color: #64748b;
}

.match-meta dd {
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
}

.flash {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.flash-ok {
  color: #166534;
}

.flash-err {
  color: #b91c1c;
}

.notice-time {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}

.pay-modal-card {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.pay-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 8px;
}

.pay-modal-text {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 16px;
}

.pay-modal-card .pay-btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  line-height: 1.5;
}

.notice-list {
  list-style: none;
}

.notice-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.notice-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.notice-list li:first-child {
  padding-top: 0;
}

.notice-list strong {
  display: block;
  margin-bottom: 4px;
}

.notice-list span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tabbar a svg {
  width: 22px;
  height: 22px;
}

.tabbar a.active {
  color: var(--accent);
}

.tabbar a.locked {
  opacity: 0.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app .user-row {
  margin-top: 0;
}

.app .lead {
  margin-bottom: 0;
}

.home-screen .app-frame {
  background:
    radial-gradient(420px 280px at 0% 0%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(380px 260px at 100% 18%, rgba(37, 99, 235, 0.3), transparent 55%),
    linear-gradient(180deg, #dbeafe 0%, #f8fafc 42%, #f8fafc 100%);
}

.welcome {
  margin-bottom: 18px;
}

.welcome-label {
  color: #475569;
  font-size: 1.05rem;
  font-weight: 600;
}

.welcome-name {
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.15;
  word-break: break-word;
}

.ad-banner {
  width: 100%;
  height: 148px;
  margin-bottom: 18px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.stats-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 148px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.stat-item {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-item + .stat-item {
  border-left: 1px solid rgba(255, 255, 255, 0.45);
}

.stat-label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  min-height: 2.7em;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #0f172a;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.profile-form input,
.profile-form select,
.profile-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: #fff;
}

.profile-form textarea {
  resize: vertical;
  min-height: 88px;
}

.profile-form button {
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 14px;
}

.form-ok {
  background: var(--success-soft);
  color: var(--success);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.app .logout {
  margin-top: 4px;
}

