:root {
  --afk-blue: #68c7eb;
  --afk-blue-deep: #257da8;
  --afk-blue-soft: #ebf8ff;
  --afk-violet: #9788e4;
  --afk-violet-deep: #6655bb;
  --afk-violet-soft: #f2efff;
  --afk-ink: #17243a;
  --afk-muted: #66758b;
  --afk-line: #d9e5ef;
  --afk-danger: #b43b59;
}

html { scroll-behavior: smooth; }
.public-shell { background: radial-gradient(circle at 6% 5%, rgba(104, 199, 235, .15), transparent 23%), radial-gradient(circle at 96% 16%, rgba(151, 136, 228, .16), transparent 26%), linear-gradient(180deg, #f8fcff 0%, #f3f7ff 47%, #fff 100%) !important; }
.public-shell main { max-width: 1320px; }
.public-shell .public-panel { border-color: rgba(205, 220, 233, .94); box-shadow: 0 20px 48px rgba(48, 70, 104, .08); }
.public-shell > main > header { position: relative; overflow: hidden; background: radial-gradient(circle at 96% 15%, rgba(151, 136, 228, .2), transparent 30%), radial-gradient(circle at 8% 100%, rgba(104, 199, 235, .18), transparent 32%), rgba(255, 255, 255, .96); }
.public-shell > main > header::after { position: absolute; right: -2.5rem; bottom: -4rem; width: 11rem; height: 11rem; border: 1.25rem solid rgba(255, 255, 255, .45); border-radius: 999px; content: ""; pointer-events: none; }
.afk-head-action { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #d5d1ef; background: #fff; color: var(--afk-violet-deep); font-weight: 850; text-decoration: none; }
.afk-head-action svg { width: 1rem; height: 1rem; }

.afk-intro-strip { display: grid; gap: .55rem; }
.afk-intro-strip > span { display: flex; align-items: center; gap: .45rem; min-width: 0; border: 1px solid #dce8f1; border-radius: .85rem; padding: .7rem .8rem; color: #77859a; background: rgba(255, 255, 255, .9); font-size: .72rem; font-weight: 700; }
.afk-intro-strip svg { width: 1rem; height: 1rem; flex: 0 0 auto; color: var(--afk-violet-deep); }
.afk-intro-strip b { color: #33445c; }

.afk-character-card, .afk-form, .afk-result, .afk-efficiency { padding: 1rem; }
.afk-card-heading { display: flex; align-items: flex-start; gap: .72rem; }
.afk-card-heading > div { min-width: 0; }
.afk-card-heading small, .afk-result-head small, .afk-section-heading small { display: block; color: #8372d3; font-size: .58rem; font-weight: 950; letter-spacing: .09em !important; }
.afk-card-heading h2, .afk-result-head h2, .afk-section-heading h2 { margin: .16rem 0 0; color: var(--afk-ink); font-size: 1.05rem; font-weight: 950; letter-spacing: -.02em !important; }
.afk-card-heading p { margin: .25rem 0 0; color: #7c899c; font-size: .64rem; line-height: 1.55; font-weight: 650; }
.afk-card-icon, .afk-choice-icon { display: grid; flex: 0 0 auto; place-items: center; color: #fff; background: linear-gradient(135deg, var(--afk-blue), #4ca5ce); }
.afk-card-icon { width: 2.8rem; height: 2.8rem; border-radius: .8rem; box-shadow: 0 8px 20px rgba(72, 156, 197, .18); }
.afk-card-icon.is-violet, .afk-choice-icon.is-violet { background: linear-gradient(135deg, #aa9beb, #7868cf); box-shadow: 0 8px 20px rgba(111, 91, 195, .18); }

.afk-character-search { display: grid; gap: .6rem; margin-top: .9rem; }
.afk-search-field { position: relative; min-width: 0; }
.afk-search-field > svg { position: absolute; top: 50%; left: .85rem; width: 1.05rem; height: 1.05rem; color: #8795a7; transform: translateY(-50%); pointer-events: none; }
.afk-search-field input, .afk-number-field input { width: 100%; border: 1px solid #cad9e6; border-radius: .75rem; color: #263750; background: #fff; font-weight: 800; box-shadow: inset 0 1px 2px rgba(35, 55, 84, .03); transition: border-color .18s ease, box-shadow .18s ease; }
.afk-search-field input { min-height: 3.25rem; padding: .72rem .85rem .72rem 2.55rem; font-size: .8rem; }
.afk-search-field input:focus, .afk-number-field input:focus { border-color: #82bfe0; outline: none; box-shadow: 0 0 0 3px rgba(104, 199, 235, .17); }
.afk-secondary-button { min-height: 3.25rem; display: inline-flex; align-items: center; justify-content: center; gap: .42rem; border: 1px solid #d2cef0; border-radius: .75rem; padding: .7rem 1rem; color: var(--afk-violet-deep); background: var(--afk-violet-soft); font-size: .72rem; font-weight: 900; transition: background .18s ease, transform .18s ease; }
.afk-secondary-button:hover { background: #e9e4ff; }
.afk-secondary-button:active { transform: translateY(1px); }
.afk-secondary-button:disabled, .afk-calculate-button:disabled { cursor: wait; opacity: .66; }
.afk-inline-status { margin-top: .7rem; border: 1px solid #cde3ef; border-radius: .7rem; padding: .65rem .75rem; color: #276f94; background: #eef9ff; font-size: .65rem; font-weight: 750; line-height: 1.5; }
.afk-inline-status.is-error { border-color: #f1c7d1; color: #9e344f; background: #fff1f4; }
.afk-inline-status.is-warning { border-color: #f0d5a3; color: #8c641c; background: #fff9eb; }
.afk-character-profile { display: grid; grid-template-columns: 2.7rem minmax(0, 1fr); align-items: center; gap: .62rem; margin-top: .75rem; border: 1px solid #d7e7f1; border-radius: .8rem; padding: .65rem; background: linear-gradient(135deg, #f2fbff, #f6f3ff); }
.afk-profile-mark { display: grid; width: 2.7rem; height: 2.7rem; place-items: center; border-radius: .72rem; color: #fff; background: linear-gradient(135deg, var(--afk-blue), var(--afk-violet)); }
.afk-character-profile small, .afk-character-profile strong { display: block; }
.afk-character-profile small { color: #8391a4; font-size: .54rem; font-weight: 750; }
.afk-character-profile strong { overflow: hidden; margin-top: .1rem; color: #293c54; font-size: .72rem; font-weight: 950; text-overflow: ellipsis; white-space: nowrap; }
.afk-profile-level { grid-column: 1 / -1; border-top: 1px solid rgba(199, 218, 232, .78); padding-top: .55rem; text-align: left; }
.afk-profile-level strong { color: var(--afk-violet-deep); }

.afk-workspace { display: grid; gap: 1rem; }
.afk-fieldset { min-width: 0; margin: 1rem 0 0; border: 0; border-top: 1px solid #e7edf3; padding: .9rem 0 0; }
.afk-fieldset > legend { padding: 0 .45rem 0 0; color: #3b4d64; font-size: .7rem; font-weight: 950; }
.afk-choice-grid, .afk-burning-list, .afk-input-grid { display: grid; gap: .58rem; }
.afk-choice-card, .afk-switch-card { position: relative; min-width: 0; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; gap: .6rem; border: 1px solid #dce5ed; border-radius: .82rem; padding: .68rem; color: #66758a; background: #fff; cursor: pointer; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.afk-choice-card:hover, .afk-switch-card:hover { border-color: #bdcfe0; background: #fbfdff; }
.afk-choice-card input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.afk-choice-icon { width: 2.5rem; height: 2.5rem; border-radius: .7rem; }
.afk-choice-icon.is-fire { background: linear-gradient(135deg, #ffb06f, #f17f80); box-shadow: 0 8px 18px rgba(225, 117, 91, .15); }
.afk-choice-icon.is-muted { color: #8795a8; background: #edf2f6; box-shadow: none; }
.afk-choice-card strong, .afk-choice-card small, .afk-switch-card strong, .afk-switch-card small { display: block; }
.afk-choice-card strong, .afk-switch-card strong { color: #33455c; font-size: .68rem; font-weight: 950; }
.afk-choice-card small, .afk-switch-card small { margin-top: .13rem; color: #8996a7; font-size: .54rem; line-height: 1.35; font-weight: 650; }
.afk-choice-card > i { display: grid; width: 1.35rem; height: 1.35rem; place-items: center; border: 1px solid #d5dee7; border-radius: 999px; color: transparent; background: #fff; }
.afk-choice-card > i svg { width: .82rem; height: .82rem; }
.afk-choice-card:has(input:checked) { border-color: #a89ce1; background: linear-gradient(135deg, #f2fbff, #f5f2ff); box-shadow: 0 0 0 2px rgba(151, 136, 228, .09); }
.afk-choice-card:has(input:checked) > i { border-color: var(--afk-violet); color: #fff; background: var(--afk-violet); }
.afk-choice-card:focus-within, .afk-switch-card:focus-within { outline: 3px solid rgba(104, 199, 235, .2); outline-offset: 2px; }

.afk-input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.afk-input-grid > label > span:first-child, .afk-mode-panel > label > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; color: #53647a; font-size: .62rem; font-weight: 900; }
.afk-fieldset label > span b { color: #7865c8; font-size: .52rem; }
.afk-number-field { position: relative; }
.afk-number-field input { min-height: 3.1rem; padding: .65rem 3.2rem .65rem .8rem; font-size: .78rem; }
.afk-number-field em { position: absolute; top: 50%; right: .8rem; color: #8492a5; font-size: .6rem; font-style: normal; font-weight: 850; transform: translateY(-50%); pointer-events: none; }
.afk-fieldset label > small, .afk-mode-panel label > small { display: block; margin-top: .28rem; color: #8b98a9; font-size: .52rem; line-height: 1.4; }
.afk-snapshot-note { display: flex; align-items: flex-start; gap: .35rem; margin: .55rem 0 0; border-radius: .65rem; padding: .52rem .6rem; color: #28739a; background: #edf9ff; font-size: .55rem; line-height: 1.45; font-weight: 750; }
.afk-snapshot-note svg { width: .9rem; height: .9rem; flex: 0 0 auto; }

.afk-switch-card.is-disabled { cursor: default; opacity: .7; }
.afk-switch-card.is-disabled:hover { border-color: #dce5ed; background: #fff; }
.afk-switch { position: relative; width: 2.4rem; height: 1.35rem; border-radius: 999px; background: #d7e0e9; transition: background .18s ease; }
.afk-switch i { position: absolute; top: .18rem; left: .18rem; width: .99rem; height: .99rem; border-radius: 999px; background: #fff; box-shadow: 0 2px 5px rgba(25, 40, 63, .2); transition: transform .18s ease; }
.afk-switch-card input:checked + .afk-switch { background: linear-gradient(90deg, var(--afk-blue), var(--afk-violet)); }
.afk-switch-card input:checked + .afk-switch i { transform: translateX(1.04rem); }
.afk-ended-badge { border-radius: 999px; padding: .3rem .45rem; color: #6e7c8e; background: #edf1f5; font-size: .48rem; font-weight: 900; white-space: nowrap; }

.afk-mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; border: 1px solid #dfe8ef; border-radius: .85rem; padding: .3rem; background: #f4f7fa; }
.afk-mode-tabs button { min-width: 0; display: flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: .65rem; padding: .58rem .4rem; color: #77869a; background: transparent; text-align: left; }
.afk-mode-tabs button > svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.afk-mode-tabs button span, .afk-mode-tabs button small { display: block; }
.afk-mode-tabs button span { font-size: .61rem; font-weight: 900; }
.afk-mode-tabs button small { display: none; margin-top: .08rem; font-size: .47rem; font-weight: 650; opacity: .75; }
.afk-mode-tabs button.is-active { color: #584aa6; background: #fff; box-shadow: 0 5px 13px rgba(63, 78, 107, .1); }
.afk-mode-panel { margin-top: .65rem; border: 1px solid #e2e9ef; border-radius: .8rem; padding: .7rem; background: #fbfdff; }
.afk-form-error { margin-top: .8rem; border: 1px solid #f0c6d0; border-radius: .7rem; padding: .65rem .75rem; color: var(--afk-danger); background: #fff1f4; font-size: .62rem; font-weight: 800; line-height: 1.5; }
.afk-calculate-button { width: 100%; min-height: 4rem; display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) 1.2rem; align-items: center; gap: .55rem; margin-top: .85rem; border: 0; border-radius: .85rem; padding: .72rem .9rem; color: #fff; background: linear-gradient(135deg, #5bbde4, #8d78db); box-shadow: 0 13px 28px rgba(102, 91, 193, .25); text-align: left; transition: transform .18s ease, box-shadow .18s ease; }
.afk-calculate-button:hover { transform: translateY(-1px); box-shadow: 0 17px 34px rgba(102, 91, 193, .3); }
.afk-calculate-button > svg { width: 1.3rem; height: 1.3rem; }
.afk-calculate-button span strong, .afk-calculate-button span small { display: block; }
.afk-calculate-button span strong { font-size: .72rem; font-weight: 950; }
.afk-calculate-button span small { margin-top: .08rem; color: #f0efff; font-size: .5rem; font-weight: 700; }
.afk-calculate-button > b { display: grid; justify-content: end; }
.afk-calculate-button > b svg { width: 1rem; height: 1rem; }

.afk-result { min-height: 25rem; align-self: start; background: radial-gradient(circle at 100% 0, rgba(151, 136, 228, .16), transparent 31%), linear-gradient(180deg, #fff, #f8fbff) !important; }
.afk-result-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.afk-result-head > span { flex: 0 0 auto; border: 1px solid #d9e1e9; border-radius: 999px; padding: .32rem .53rem; color: #7b8899; background: #f4f7fa; font-size: .52rem; font-weight: 900; }
.afk-result-head > span.is-ready { border-color: #c9c0ee; color: #6654b7; background: #f1edff; }
.afk-result-empty { min-height: 19rem; display: grid; justify-items: center; align-content: center; padding: 1rem; text-align: center; }
.afk-result-empty > span { display: grid; width: 4.2rem; height: 4.2rem; place-items: center; border-radius: 1.2rem; color: #fff; background: linear-gradient(135deg, var(--afk-blue), var(--afk-violet)); box-shadow: 0 16px 32px rgba(96, 99, 183, .21); }
.afk-result-empty > span svg { width: 2rem; height: 2rem; }
.afk-result-empty strong { margin-top: 1rem; color: #2d4058; font-size: .9rem; font-weight: 950; }
.afk-result-empty p { max-width: 21rem; margin: .4rem 0 0; color: #7c899b; font-size: .63rem; line-height: 1.65; }
.afk-level-result { display: grid; grid-template-columns: minmax(0, 1fr) 2.2rem minmax(0, 1fr); align-items: center; gap: .35rem; margin-top: 1rem; }
.afk-level-result > div { min-width: 0; border: 1px solid #dee7ee; border-radius: .85rem; padding: .72rem; background: rgba(255, 255, 255, .9); }
.afk-level-result > div.is-final { border-color: #cfc6ef; background: linear-gradient(135deg, #f2fbff, #f3f0ff); }
.afk-level-result small, .afk-level-result strong, .afk-level-result span { display: block; }
.afk-level-result small { color: #8492a4; font-size: .5rem; font-weight: 800; }
.afk-level-result strong { margin-top: .16rem; color: #2d4058; font-size: 1.12rem; font-weight: 950; letter-spacing: -.03em !important; }
.afk-level-result span { margin-top: .08rem; overflow: hidden; color: #758397; font-size: .55rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.afk-level-result .is-final strong { color: #6251b4; }
.afk-result-arrow { display: grid; place-items: center; color: #8a78d8; }
.afk-result-arrow svg { width: 1.25rem; height: 1.25rem; }
.afk-progress { height: .55rem; overflow: hidden; margin-top: .7rem; border-radius: 999px; background: #e7edf3; }
.afk-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--afk-blue), var(--afk-violet)); transition: width .35s ease; }
.afk-result-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .75rem; }
.afk-result-stats article { min-width: 0; display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); align-items: center; gap: .42rem; border: 1px solid #e1e8ef; border-radius: .72rem; padding: .58rem; background: rgba(255, 255, 255, .92); }
.afk-result-stats article > span { grid-row: 1 / 3; display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border-radius: .55rem; color: #6e5fc1; background: #f0edff; }
.afk-result-stats svg { width: .92rem; height: .92rem; }
.afk-result-stats small, .afk-result-stats strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afk-result-stats small { align-self: end; color: #8a96a6; font-size: .46rem; font-weight: 750; }
.afk-result-stats strong { align-self: start; color: #34465d; font-size: .59rem; font-weight: 950; }
.afk-result-notice { margin-top: .65rem; border: 1px solid #d4e7f1; border-radius: .68rem; padding: .58rem .65rem; color: #2f7597; background: #eef9ff; font-size: .56rem; font-weight: 750; line-height: 1.5; }
.afk-milestones { margin-top: .8rem; border-top: 1px solid #e4eaf0; padding-top: .7rem; }
.afk-milestones h3 { margin: 0; color: #46586e; font-size: .62rem; font-weight: 950; }
.afk-milestones > div { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.afk-milestone { display: inline-flex; align-items: center; gap: .24rem; border: 1px solid #dce5ec; border-radius: 999px; padding: .28rem .43rem; color: #69788c; background: #fff; font-size: .49rem; font-weight: 850; }
.afk-milestone.is-hyper { border-color: #f0c7b5; color: #a45a36; background: #fff5ef; }
.afk-milestone.is-beyond { border-color: #d5cef1; color: #6c5bbd; background: #f4f1ff; }

.afk-efficiency { scroll-margin-top: 1rem; }
.afk-section-heading { display: flex; flex-direction: column; gap: .65rem; }
.afk-section-heading > div { display: flex; align-items: center; gap: .65rem; }
.afk-section-heading > p { margin: 0; color: #7c899b; font-size: .62rem; line-height: 1.5; font-weight: 650; }
.afk-rate-grid { display: grid; gap: .55rem; margin-top: .9rem; }
.afk-rate-group { overflow: hidden; border: 1px solid #dce5ec; border-radius: .75rem; background: #fff; }
.afk-rate-group[open] { border-color: #cadce8; }
.afk-rate-group summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .68rem .75rem; color: #41536a; background: #f7fafc; cursor: pointer; font-size: .64rem; font-weight: 950; list-style: none; }
.afk-rate-group summary::-webkit-details-marker { display: none; }
.afk-rate-group summary b { display: grid; color: #7b6dcc; transition: transform .18s ease; }
.afk-rate-group summary svg { width: .95rem; height: .95rem; transform: rotate(90deg); }
.afk-rate-group[open] summary b { transform: rotate(90deg); }
.afk-rate-content { border-top: 1px solid #e3eaf0; }
.afk-rate-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.35rem; padding: .42rem .72rem; border-bottom: 1px solid #edf1f5; color: #596a80; font-size: .58rem; font-weight: 800; }
.afk-rate-row:last-child { border-bottom: 0; }
.afk-rate-row:nth-child(odd) { background: #fbfdff; }
.afk-rate-row strong { color: #293d56; font-size: .6rem; font-weight: 950; }
.afk-rate-row.is-current { color: #5f4fb2; background: linear-gradient(90deg, #eefaff, #f2efff); }
.afk-rate-row.is-current strong { color: #5f4fb2; }
.afk-data-note { margin-top: .8rem; border: 1px solid #dbe8f0; border-radius: .75rem; padding: .7rem; color: #66768a; background: linear-gradient(135deg, #f2fbff, #f6f3ff); font-size: .58rem; line-height: 1.55; }
.afk-data-note p { display: flex; align-items: flex-start; gap: .42rem; margin: 0; }
.afk-data-note svg { width: 1rem; height: 1rem; flex: 0 0 auto; color: #6a59b9; }

@media (min-width: 640px) {
  .afk-intro-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .afk-character-card, .afk-form, .afk-result, .afk-efficiency { padding: 1.3rem; }
  .afk-character-search { grid-template-columns: minmax(0, 1fr) auto; }
  .afk-secondary-button { min-width: 9.5rem; }
  .afk-character-profile { grid-template-columns: 2.7rem minmax(0, 1fr) auto; }
  .afk-profile-level { grid-column: auto; border-top: 0; border-left: 1px solid rgba(199, 218, 232, .78); padding: 0 0 0 .8rem; text-align: right; }
  .afk-facility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afk-mode-tabs button small { display: block; }
  .afk-section-heading { flex-direction: row; align-items: center; justify-content: space-between; }
  .afk-rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .afk-workspace { grid-template-columns: minmax(0, 1.08fr) minmax(21rem, .92fr); align-items: start; }
  .afk-result { position: sticky; top: 1rem; }
  .afk-rate-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .afk-rate-group summary b { display: none; }
}

@media (max-width: 479px) {
  .public-shell main { padding-right: .65rem; padding-left: .65rem; }
  .afk-character-card, .afk-form, .afk-result, .afk-efficiency { padding: .85rem; }
  .afk-input-grid { grid-template-columns: 1fr; }
  .afk-choice-card, .afk-switch-card { grid-template-columns: 2.35rem minmax(0, 1fr) auto; padding: .6rem; }
  .afk-choice-icon { width: 2.35rem; height: 2.35rem; }
  .afk-mode-tabs button { justify-content: flex-start; }
  .afk-result-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .afk-secondary-button, .afk-choice-card, .afk-switch-card, .afk-switch, .afk-switch i, .afk-calculate-button, .afk-progress span, .afk-rate-group summary b { transition: none; }
  .afk-calculate-button:hover { transform: none; }
}
