:root {
  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-quiet: #f5f7f9;
  --line: #d4dce5;
  --line-strong: #b8c4d2;
  --text: #172026;
  --muted: #66717e;
  --teal: #0f766e;
  --teal-dark: #0b5e57;
  --blue: #244fc7;
  --coral: #d65a45;
  --amber: #b7791f;
  --red: #b42318;
  --green: #087443;
  --nav-bg: rgba(16, 25, 35, 0.94);
  --nav-text: #f8fbfd;
  --shadow: 0 18px 46px rgba(19, 31, 45, 0.09);
  --shadow-soft: 0 1px 2px rgba(19, 31, 45, 0.07);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbfc 0%, var(--bg) 42%, #e8eef3 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.dark-mode,
body.dark-mode {
  --bg: #101417;
  --surface: #171d22;
  --surface-quiet: #202830;
  --line: #303a43;
  --line-strong: #46525f;
  --text: #eef4f7;
  --muted: #a7b4bf;
  --nav-bg: rgba(7, 10, 14, 0.95);
  --nav-text: #f8fbfd;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

html.dark-mode .panel-toolbar,
html.dark-mode .panel-actions,
html.dark-mode .furigana-box,
html.dark-mode .kanji-detail,
html.dark-mode th,
html.dark-mode .auth-copy,
html.dark-mode .mini-item,
html.dark-mode .history-item,
html.dark-mode .ko-ja-tool .mini-result,
html.dark-mode .test-card,
html.dark-mode .mini-result,
html.dark-mode .stat-row span,
html.dark-mode .info-chip,
body.dark-mode .panel-toolbar,
body.dark-mode .panel-actions,
body.dark-mode .furigana-box,
body.dark-mode .kanji-detail,
body.dark-mode th,
body.dark-mode .auth-copy,
body.dark-mode .mini-item,
body.dark-mode .history-item,
body.dark-mode .ko-ja-tool .mini-result,
body.dark-mode .test-card,
body.dark-mode .mini-result,
body.dark-mode .stat-row span,
body.dark-mode .info-chip {
  background: var(--surface-quiet);
}

html.dark-mode body,
body.dark-mode {
  background:
    linear-gradient(180deg, #11171d 0%, var(--bg) 48%, #0b0f13 100%);
}

html.dark-mode .auth-body,
body.dark-mode.auth-body {
  background: var(--bg);
}

html.dark-mode .nav-links a.active,
body.dark-mode .nav-links a.active {
  background: #ffffff;
  color: #111827;
}

a {
  color: var(--teal-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 74px;
  padding: 10px 0;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 34px rgba(7, 12, 18, 0.2);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1240px, calc(100% - 32px));
  min-height: 54px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  color: var(--nav-text);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  box-shadow: inset 0 -3px 0 rgba(15, 118, 110, 0.28);
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-text {
  color: var(--nav-text);
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.1;
}

.brand-subtitle {
  color: rgba(248, 251, 253, 0.66);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.nav-links a {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  color: rgba(248, 251, 253, 0.78);
  font-size: 14px;
  font-weight: 850;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-text);
  text-decoration: none;
}

.nav-links a.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.nav-actions,
.auth-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 220px;
}

.auth-nav-actions a,
.ghost-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.ghost-button,
.small-button {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.ghost-button:hover,
.small-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-quiet);
}

.ghost-button:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar .ghost-button,
.topbar .session-badge,
.auth-nav-actions a {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 253, 0.84);
  box-shadow: none;
}

.topbar .ghost-button:hover,
.auth-nav-actions a:hover,
.auth-nav-actions a.active {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.16);
  color: var(--nav-text);
  text-decoration: none;
}

.topbar .theme-toggle {
  border-color: rgba(255, 255, 255, 0.26);
  background: #ffffff;
  color: #111827;
  font-weight: 900;
}

.topbar .theme-toggle:hover {
  background: #e9f8f5;
  color: var(--teal-dark);
}

.logout-form {
  margin: 0;
}

.auth-body {
  background:
    linear-gradient(180deg, #f9fbfc 0%, #eef3f6 50%, #e7edf2 100%);
}

.auth-shell,
.workspace {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
  padding: 42px 0;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  width: min(960px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  padding: 46px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(36, 79, 199, 0.08)),
    var(--surface-quiet);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.auth-copy h1,
.workspace-heading h1,
.error-panel h1 {
  margin-bottom: 14px;
  font-size: 34px;
  line-height: 1.18;
}

.auth-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: flex;
  flex-direction: column;
  padding: 36px;
}

label {
  margin: 18px 0 7px;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

input {
  height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 315px;
  resize: vertical;
  padding: 18px;
  border: 0;
  border-radius: 0;
  line-height: 1.8;
  font-size: 18px;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.22);
}

.field-help,
.form-alt,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.field-help {
  margin: 7px 0 0;
}

.form-alt {
  margin: 18px 0 0;
  text-align: center;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.notice-error {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.primary-button:hover {
  background: var(--teal-dark);
  text-decoration: none;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.full-width {
  width: 100%;
  margin-top: 24px;
}

.inline-button {
  margin-top: 10px;
}

.workspace {
  padding: 28px 0 60px;
}

.translator-shell,
.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 2px 4px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.08);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-heading h1 {
  margin-bottom: 0;
  font-weight: 900;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.translator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.translator-grid::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--coral));
  pointer-events: none;
}

.text-panel {
  min-width: 0;
  background: var(--surface);
}

.input-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.output-panel {
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-quiet);
}

.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
}

.panel-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--coral);
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
}

.translation-output {
  min-height: 224px;
  padding: 24px;
  line-height: 1.8;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.placeholder,
.empty-text,
.empty-cell,
.empty-chip {
  color: var(--muted);
}

.provider-badge,
.mini-status,
.security-event-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
}

.provider-cache,
.security-event-login_success,
.security-event-account_created {
  border-color: #b8e6cc;
  background: #e4f7ec;
  color: var(--green);
}

.provider-local {
  border-color: #b9e2dc;
  background: #e7f5f2;
  color: var(--teal-dark);
}

.provider-ai,
.security-event-user_status_changed,
.security-event-user_role_changed {
  border-color: #f8d49a;
  background: #fff7e8;
  color: #9a5b05;
}

.provider-external {
  border-color: #bfd3ff;
  background: #eaf1ff;
  color: var(--blue);
}

.provider-error,
.security-event-login_failed,
.security-event-login_inactive,
.security-event-security_blocked,
.security-event-admin_denied {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.provider-loading,
.provider-idle,
.security-event-logout {
  border-color: var(--line);
  background: var(--surface-quiet);
  color: var(--muted);
}

.furigana-box {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
}

.furigana-output {
  min-height: 72px;
  margin-top: 12px;
  line-height: 2.2;
  font-size: 20px;
  overflow-wrap: anywhere;
}

ruby {
  margin-right: 2px;
}

rt {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.analysis-grid,
.quick-grid,
.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.quick-grid {
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
}

.feature-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.more-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.more-panel summary {
  min-height: 52px;
  padding: 16px 20px;
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
  background: var(--surface-quiet);
}

.more-panel .feature-grid {
  padding: 0 18px 18px;
}

.analysis-section,
.error-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.section-heading {
  min-height: 54px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-quiet);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 900;
}

.split-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap,
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.analysis-section .table-wrap {
  max-height: 540px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  background: var(--surface-quiet);
  white-space: nowrap;
}

.analysis-section th {
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.word-table {
  min-width: 820px;
  table-layout: fixed;
}

.word-table td:first-child {
  font-weight: 800;
}

.word-table th:nth-child(1),
.word-table td:nth-child(1) {
  width: 15%;
}

.word-table th:nth-child(2),
.word-table td:nth-child(2) {
  width: 16%;
}

.word-table th:nth-child(3),
.word-table td:nth-child(3) {
  width: 20%;
}

.word-table th:nth-child(4),
.word-table td:nth-child(4) {
  width: 10%;
}

.word-table th:nth-child(5),
.word-table td:nth-child(5) {
  width: 13%;
}

.word-table th:nth-child(6),
.word-table td:nth-child(6) {
  width: 16%;
}

.word-table th:nth-child(7),
.word-table td:nth-child(7) {
  width: 10%;
}

.meaning-missing {
  color: var(--amber);
  font-weight: 800;
}

.tool-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.tool-row,
.quiz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.kana-converter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.ko-ja-tool {
  display: grid;
  gap: 10px;
}

.ko-ja-tool textarea {
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  line-height: 1.6;
  font-size: 15px;
}

.ko-ja-tool .mini-result {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-quiet);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.list-heading h3 {
  margin: 0;
}

.study-summary {
  padding-top: 18px;
}

.mini-result,
.mini-list,
.quiz-box {
  display: grid;
  gap: 8px;
}

.paged-list {
  min-height: 456px;
  padding: 18px;
}

.quick-history-list {
  align-content: start;
  min-height: 222px;
  padding: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 52px;
  padding: 10px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
}

.pagination span {
  min-width: 64px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 50px;
  padding: 10px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
}

.result-footer:empty {
  display: none;
}

.result-count,
.page-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.page-label {
  min-width: 56px;
  text-align: center;
}

.mini-status {
  margin-bottom: 2px;
}

.mini-item,
.history-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.mini-item .small-button {
  justify-self: flex-start;
}

.history-item {
  cursor: pointer;
  color: var(--text);
}

.history-item:hover {
  border-color: var(--teal);
  background: #effaf7;
}

html.dark-mode .history-item:hover,
body.dark-mode .history-item:hover {
  border-color: #62cfc1;
  background: #123e3a;
}

.mini-item span,
.history-item span,
.mini-item small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.stat-row,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-row span,
.info-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow-soft);
}

.stat-row strong {
  margin-left: 5px;
  color: var(--text);
}

.info-chip {
  border-radius: 8px;
  padding: 8px 10px;
}

.tool-body h3 {
  margin: 6px 0 0;
  font-size: 15px;
}

.kanji-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px;
  min-height: 60px;
}

.kanji-chip,
.empty-chip {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.kanji-chip {
  cursor: pointer;
}

.kanji-chip:hover,
.kanji-chip.active {
  border-color: var(--teal);
  background: #e7f5f2;
  color: var(--teal-dark);
}

html.dark-mode .kanji-chip,
html.dark-mode .empty-chip,
body.dark-mode .kanji-chip,
body.dark-mode .empty-chip {
  border-color: var(--line-strong);
  background: #11181d;
  color: #eef4f7;
}

html.dark-mode .kanji-chip:hover,
html.dark-mode .kanji-chip.active,
body.dark-mode .kanji-chip:hover,
body.dark-mode .kanji-chip.active {
  border-color: #62cfc1;
  background: #123e3a;
  color: #9ff2e4;
}

.empty-chip {
  width: 100%;
  justify-content: flex-start;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
}

.kanji-detail {
  min-height: 230px;
  max-height: 560px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
  overflow: auto;
}

.kanji-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.kanji-large {
  display: inline-grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 38px;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(214, 90, 69, 0.44);
}

html.dark-mode .kanji-large,
body.dark-mode .kanji-large {
  background: #dff8f1;
  color: #0b5e57;
}

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

.detail-lines {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.detail-line {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  line-height: 1.5;
}

.detail-line span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-line strong {
  overflow-wrap: anywhere;
}

.kanji-detail h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.example-list {
  display: grid;
  gap: 8px;
}

.example-item {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(90px, 0.9fr) minmax(0, 1.5fr);
  gap: 10px 12px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.example-item strong,
.example-item small,
.example-item span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.example-item small,
.example-item span {
  color: var(--muted);
}

.test-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
}

.test-side,
.test-main {
  min-width: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-quiet);
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: var(--shadow-soft);
}

.test-card {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-quiet);
}

.test-prompt {
  margin: 0;
  line-height: 1.5;
  font-size: 28px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.result-correct {
  color: var(--green);
}

.result-wrong {
  color: var(--red);
}

.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.admin-table {
  min-width: 900px;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.role-admin {
  background: #e0ecff;
  color: var(--blue);
}

.status-active {
  background: #e4f7ec;
  color: var(--green);
}

.status-disabled {
  background: #fff1f2;
  color: var(--red);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.error-panel {
  width: min(640px, 100%);
  margin: 44px auto;
  padding: 34px;
}

.error-panel p {
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 860px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .nav-links {
    justify-content: flex-start;
    width: 100%;
  }

  .nav-actions,
  .auth-nav-actions {
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .auth-panel,
  .translator-grid,
  .analysis-grid,
  .quick-grid,
  .feature-grid,
  .test-shell {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
    padding: 30px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-form {
    padding: 28px;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  textarea {
    min-height: 250px;
  }

  .ko-ja-tool textarea {
    min-height: 120px;
  }

  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: flex-start;
  }

  .more-panel .feature-grid {
    padding: 0 12px 12px;
  }
}

@media (max-width: 560px) {
  .auth-shell,
  .workspace {
    width: min(100% - 20px, 1240px);
  }

  .topbar-inner {
    width: min(100% - 20px, 1240px);
  }

  .brand {
    white-space: normal;
  }

  .brand-subtitle {
    display: none;
  }

  .auth-copy h1,
  .workspace-heading h1,
  .error-panel h1 {
    font-size: 27px;
  }

  .panel-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .panel-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .panel-actions .primary-button,
  .panel-actions .ghost-button {
    width: 100%;
  }

  .translation-output,
  .furigana-output {
    font-size: 18px;
  }

  .example-item {
    grid-template-columns: 1fr;
  }

  .paged-list {
    min-height: 0;
    padding: 12px;
  }

  .pagination {
    justify-content: stretch;
    padding: 10px 12px 14px;
  }

  .result-footer {
    justify-content: stretch;
    flex-wrap: wrap;
    padding: 10px 12px 14px;
  }

  .pagination .small-button {
    flex: 1;
  }

  .result-footer .small-button {
    flex: 1;
  }

  .result-count {
    width: 100%;
  }

  .test-prompt {
    font-size: 22px;
  }
}
