/* ================= 我的帳號（只在 account.html 載入） ================= */
:root {
  --success: #1f9d55;
  --success-soft: #e3f6ea;
  --info-soft: #e8eefc;
  --info: #3456c7;
  --danger: #d1343a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --success: #4cc985; --success-soft: #16301f;
    --info: #9db2ff; --info-soft: #1b2340;
    --danger: #ff6b70;
  }
}
:root[data-theme="dark"] {
  --success: #4cc985; --success-soft: #16301f;
  --info: #9db2ff; --info-soft: #1b2340;
  --danger: #ff6b70;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.account { padding-top: 32px; padding-bottom: 72px; min-height: calc(100vh - 64px - 90px); }
.page-title { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 900; margin-bottom: 20px; }

.user-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip img { border-radius: 50%; flex: none; }
.user-chip span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
@media (max-width: 420px) { .user-chip span { display: none; } }

.banner { border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; font-weight: 500; }
.banner-info { background: var(--info-soft); color: var(--info); }
.banner-success { background: var(--success-soft); color: var(--success); }
.banner-error { background: var(--accent-soft); color: var(--danger); }

.login-card {
  max-width: 480px; margin: 48px auto; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.6rem; font-weight: 900; margin-bottom: 8px; }
.login-card p { color: var(--muted); }
.login-card .btn { margin: 12px 0 4px; }
.fine { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
}
@media (max-width: 480px) { .panel { padding: 18px; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.panel h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel h2 > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-dot {
  display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: .85rem; font-weight: 900;
}
.hint { color: var(--muted); margin: 0 0 16px; font-size: .95rem; }
.empty { color: var(--muted); margin: 8px 0 0; }

.link-btn {
  background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 700; font-size: .9rem;
  color: var(--accent); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }

.search { display: block; margin-bottom: 14px; }
.search input {
  width: 100%; font: inherit; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.search input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }

.guild-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.guild-card {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-width: 0;
  padding: 12px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.guild-card:hover { border-color: var(--muted); }
.guild-card[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.guild-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.guild-icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; background: var(--bg-alt); color: var(--muted); font-weight: 700; font-size: .9rem;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-meta { display: grid; min-width: 0; }
.guild-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-status { color: var(--accent); font-size: .85rem; font-weight: 500; }
.guild-status.is-muted { color: var(--muted); }

.current-plan { margin: 4px 0 16px; }
.current-plan h3 { font-size: .95rem; color: var(--muted); margin: 8px 0; }
.current-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); margin-bottom: 8px;
}
.current-row p { margin: 0; }
.hint-inline { color: var(--muted); font-size: .85rem; }

.callout { border: 1px dashed var(--border); border-radius: 12px; padding: 18px; background: var(--bg); }
.callout p { margin: 0 0 14px; }
.callout-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.checkout fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.plan-options { display: grid; gap: 10px; }
@media (min-width: 720px) { .plan-options { grid-template-columns: 1fr 1fr; } }
.plan-option {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--bg);
  transition: border-color .15s, background .15s;
}
.plan-option:hover { border-color: var(--muted); }
.plan-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.plan-option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.plan-option.is-disabled { opacity: .55; cursor: not-allowed; }
.plan-option input { margin: 5px 0 0; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.plan-option-body { display: grid; gap: 4px; min-width: 0; }
.plan-option-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.plan-option-name { font-weight: 700; }
.plan-option-price { font-weight: 900; }
.plan-option-desc { color: var(--muted); font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }

.orders { list-style: none; padding: 0; margin: 8px 0 0; }
.order {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.order:last-child { border-bottom: 0; }
.order p { margin: 0; }
.order > div:first-child { min-width: 0; }
.order-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-meta { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.order-pay { margin-top: .35rem; font-size: .9rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.order-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; font-weight: 700; }
.badge { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.badge-paid { background: var(--success-soft); color: var(--success); }
.badge-pending { background: var(--info-soft); color: var(--info); }
.badge-failed { background: var(--accent-soft); color: var(--danger); }

.skeleton { background: var(--bg-alt); border-radius: 12px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton-title { height: 36px; width: 200px; margin-bottom: 20px; }
.skeleton-card { height: 66px; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  html { scroll-behavior: auto; }
}

.dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  background: var(--surface); color: var(--text); max-width: min(420px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dialog h2 { font-size: 1.2rem; margin-bottom: 8px; }
.dialog p { color: var(--muted); margin: 0 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.agree { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; font-size: .92rem; cursor: pointer; }
.agree input { margin-top: .35em; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.agree a { color: var(--accent); }

.field { margin: 0 0 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; padding: .7em .9em; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field .fine { margin-top: 6px; }
