:root {
  --background: #0b0e0d;
  --surface: #111513;
  --surface-raised: #171c19;
  --surface-hover: #1c221e;
  --foreground: #eef4ef;
  --muted: #929d96;
  --subtle: #66716a;
  --border: rgba(229, 242, 232, 0.11);
  --border-strong: rgba(229, 242, 232, 0.2);
  --accent: #b7f36b;
  --accent-strong: #cdfa92;
  --accent-ink: #16200f;
  --danger: #ff857c;
  --danger-bg: rgba(255, 133, 124, 0.1);
  --warning: #f2c866;
  --topbar: rgba(11, 14, 13, 0.92);
  --soft-fill: rgba(255, 255, 255, 0.03);
  --soft-fill-hover: rgba(255, 255, 255, 0.06);
  --accent-fill: rgba(183, 243, 107, 0.08);
  --accent-border: rgba(183, 243, 107, 0.24);
  --card-highlight: rgba(255, 255, 255, 0.03);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --control-height: 48px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

html[data-theme="light"] {
  --background: #eef2ed;
  --surface: #ffffff;
  --surface-raised: #f8faf7;
  --surface-hover: #f1f5ef;
  --foreground: #172019;
  --muted: #4d5b50;
  --subtle: #667269;
  --border: rgba(23, 32, 25, 0.13);
  --border-strong: rgba(23, 32, 25, 0.24);
  --accent: #356b17;
  --accent-strong: #285510;
  --accent-ink: #ffffff;
  --danger: #a32f2a;
  --danger-bg: rgba(163, 47, 42, 0.08);
  --warning: #7a5700;
  --topbar: rgba(255, 255, 255, 0.94);
  --soft-fill: rgba(23, 32, 25, 0.045);
  --soft-fill-hover: rgba(23, 32, 25, 0.08);
  --accent-fill: rgba(53, 107, 23, 0.09);
  --accent-border: rgba(53, 107, 23, 0.3);
  --card-highlight: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 80px rgba(35, 50, 39, 0.13), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; min-height: 100vh; color: var(--foreground); background: var(--background); }
button, input, select { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-160%); padding: 12px 16px; border-radius: var(--radius-sm); color: var(--accent-ink); background: var(--accent); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-weight: 720; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.button-primary { color: var(--accent-ink); background: var(--accent); box-shadow: 0 8px 28px rgba(183, 243, 107, 0.14); }
.button-primary:hover { background: var(--accent-strong); }
.button-quiet { border-color: var(--border); color: var(--foreground); background: var(--soft-fill); }
.button-quiet:hover { border-color: var(--border-strong); background: var(--soft-fill-hover); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 560px) 1fr; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(32px, 7vw, 96px); border-right: 1px solid var(--border); background: var(--surface); }
.brand-mark, .wordmark-icon { display: inline-flex; gap: 3px; align-items: flex-end; }
.brand-mark { margin-bottom: 64px; }
.brand-mark span, .wordmark-icon i { display: block; width: 8px; background: var(--accent); transform: skew(-18deg); }
.brand-mark span:nth-child(1), .wordmark-icon i:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2), .wordmark-icon i:nth-child(2) { height: 26px; }
.brand-mark span:nth-child(3), .wordmark-icon i:nth-child(3) { height: 14px; }
.login-panel h1 { margin: 0; font-size: clamp(44px, 6vw, 72px); line-height: 0.94; letter-spacing: -0.06em; }
.login-copy { max-width: 420px; margin: 24px 0 40px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.login-form { display: grid; gap: 12px; max-width: 420px; }
.login-form label { margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.login-form input { height: var(--control-height); min-height: var(--control-height); padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--foreground); background: var(--background); }
.login-form input:hover { border-color: var(--border-strong); }
.login-form .button { margin-top: 12px; }
.form-message { min-height: 20px; margin: 4px 0 0; color: var(--danger); font-size: 13px; }
.login-aside { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 48px; background: radial-gradient(circle at 60% 38%, rgba(183,243,107,0.11), transparent 26%), var(--background); }
.aside-grid { position: absolute; inset: 0; opacity: .36; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, black, transparent 86%); }
.login-aside::before { content: ""; position: absolute; width: 360px; height: 360px; top: 50%; left: 50%; border: 1px solid var(--border-strong); border-radius: 50%; transform: translate(-50%, -58%); box-shadow: 0 0 0 64px rgba(183,243,107,.015), 0 0 0 128px rgba(183,243,107,.01); }
.login-aside::after { content: "SKILL"; position: absolute; top: 50%; left: 50%; color: rgba(238,244,239,.06); font-size: 14vw; font-weight: 850; letter-spacing: -.08em; transform: translate(-50%, -65%); }
.aside-copy { position: relative; z-index: 1; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.status-dot, .sync-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(183,243,107,.08); }
html[data-theme="light"] .login-aside { background: radial-gradient(circle at 60% 38%, rgba(53,107,23,.1), transparent 26%), var(--background); }
html[data-theme="light"] .login-aside::after { color: rgba(23,32,25,.055); }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 0 24px; border-bottom: 1px solid var(--border); color: var(--foreground); background: var(--topbar); backdrop-filter: blur(16px); }
.wordmark { display: inline-flex; gap: 12px; align-items: center; color: var(--foreground); font-size: 14px; font-weight: 780; text-decoration: none; }
.wordmark-icon i { width: 5px; }
.wordmark-icon i:nth-child(1) { height: 11px; }
.wordmark-icon i:nth-child(2) { height: 16px; }
.wordmark-icon i:nth-child(3) { height: 9px; }
.topbar-actions { display: flex; gap: 16px; align-items: center; }
.theme-toggle { min-width: 96px; }
.sync-state { display: inline-flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.sync-state.is-syncing i { animation: sync-pulse 900ms ease-in-out infinite alternate; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { display: flex; flex-direction: column; padding: 40px 24px 24px; border-right: 1px solid var(--border); background: var(--surface); }
.sidebar-intro h1 { margin: 0 0 12px; font-size: 28px; letter-spacing: -.04em; }
.sidebar-intro > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.filter-nav { display: grid; gap: 4px; margin-top: 40px; }
.filter-button { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); background: transparent; cursor: pointer; text-align: left; }
.filter-button > span { display: flex; gap: 10px; align-items: center; }
.filter-button b { color: var(--subtle); font-size: 12px; }
.filter-button:hover { color: var(--foreground); background: var(--soft-fill); }
.filter-button.is-active { border-color: var(--border); color: var(--foreground); background: var(--soft-fill-hover); }
.filter-button.is-active b { color: var(--accent); }
.filter-indicator { width: 7px; height: 7px; border-radius: 50%; }
.filter-indicator.active { background: var(--accent); }
.filter-indicator.disabled { background: var(--subtle); }
.sidebar-note { display: flex; gap: 12px; margin-top: auto; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--muted); background: var(--soft-fill); }
.sidebar-note > span { color: var(--accent); }
.sidebar-note p { margin: 0; font-size: 11px; line-height: 1.55; }

.content { width: min(1120px, 100%); padding: 48px clamp(24px, 5vw, 72px) 72px; }
.content-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.content-header h2 { margin: 0; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.055em; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px; gap: 12px; margin-top: 36px; }
.search-field, .select-field { height: var(--control-height); min-height: var(--control-height); }
.search-field { position: relative; display: flex; align-items: center; }
.search-field > span:not(.sr-only) { position: absolute; left: 16px; color: var(--subtle); font-size: 22px; }
.search-field input, .select-field select { display: block; width: 100%; height: 100%; min-height: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--foreground); background: var(--surface); line-height: 1.2; }
.search-field input { padding: 0 48px; }
.search-field input::placeholder { color: var(--subtle); }
.search-field kbd { position: absolute; right: 14px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 5px; color: var(--subtle); background: var(--surface-raised); font-size: 11px; }
.select-field select { padding: 0 14px; cursor: pointer; }
.results-meta { display: flex; justify-content: space-between; margin: 24px 0 12px; color: var(--subtle); font-size: 12px; }
.results-meta p { margin: 0; }
.skill-list { display: grid; gap: 8px; }
.skill-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 104px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--foreground); background: var(--surface); box-shadow: 0 1px 0 var(--card-highlight) inset; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease; }
.skill-card:hover { border-color: var(--border-strong); background: var(--surface-raised); transform: translateX(2px); }
.skill-card.is-working { opacity: .62; pointer-events: none; }
.skill-glyph { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; color: var(--accent); background: var(--background); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 800; }
.skill-card[data-status="disabled"] .skill-glyph { color: var(--subtle); }
.skill-copy { min-width: 0; }
.skill-title-row { display: flex; gap: 10px; align-items: center; }
.skill-title-row h3 { overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { flex: none; padding: 3px 7px; border-radius: 999px; color: var(--accent); background: var(--accent-fill); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.status-badge.disabled { color: var(--muted); background: var(--soft-fill-hover); }
.skill-description { display: -webkit-box; overflow: hidden; margin: 7px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skill-meta { display: flex; gap: 12px; color: var(--subtle); font-size: 10px; }
.toggle-button { min-width: 106px; }
.toggle-button.enable { border-color: var(--accent-border); color: var(--accent); background: var(--accent-fill); }
.toggle-button.disable:hover { border-color: rgba(255,133,124,.28); color: var(--danger); background: var(--danger-bg); }
.skill-actions { display: flex; gap: 8px; align-items: center; }
.open-button { min-width: 92px; }
.empty-state { padding: 72px 24px; border: 1px dashed var(--border); border-radius: var(--radius-md); text-align: center; }
.empty-state > span { color: var(--subtle); font-size: 36px; }
.empty-state h3 { margin: 16px 0 8px; }
.empty-state p { margin: 0; color: var(--muted); }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); color: var(--foreground); background: var(--surface-raised); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4,6,5,.76); backdrop-filter: blur(6px); }
.dialog-panel { padding: 28px; }
.dialog-header { display: flex; justify-content: space-between; gap: 16px; }
.dialog-header h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); background: transparent; cursor: pointer; font-size: 24px; }
.dialog-copy { margin: 20px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
code { padding: 2px 5px; border-radius: 4px; color: var(--accent); background: var(--accent-fill); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.drop-zone { display: grid; place-items: center; min-height: 180px; padding: 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); cursor: pointer; text-align: center; background: var(--background); }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: var(--accent-fill); }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone strong { margin: 12px 0 4px; }
.drop-zone > span:last-of-type { color: var(--muted); font-size: 12px; }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.detail-dialog { width: min(960px, calc(100% - 32px)); max-height: calc(100vh - 32px); }
.detail-panel { display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr); min-height: min(760px, calc(100vh - 32px)); padding: 0; }
.detail-header { display: flex; justify-content: space-between; gap: 24px; padding: 28px 32px 20px; border-bottom: 1px solid var(--border); }
.detail-header h2 { margin: 0; font-size: clamp(24px, 4vw, 36px); letter-spacing: -.045em; overflow-wrap: anywhere; }
.detail-tabs { display: flex; gap: 4px; padding: 12px 32px 0; }
.detail-tab { min-height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; cursor: pointer; font-weight: 720; }
.detail-tab:hover { color: var(--foreground); }
.detail-tab.is-active { border-bottom-color: var(--accent); color: var(--accent); }
.translation-note { margin: 12px 32px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); background: var(--surface); font-size: 12px; }
.detail-loading { margin: 16px 32px 0; color: var(--accent); font-size: 13px; }
.skill-document { min-height: 0; margin: 16px 0 0; padding: 8px 32px 40px; overflow: auto; color: var(--foreground); background: transparent; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.toast-region { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100% - 40px)); }
.toast { padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--foreground); background: var(--surface-raised); box-shadow: var(--shadow); font-size: 13px; animation: toast-in 220ms ease both; }
.toast.error { border-color: rgba(255,133,124,.35); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes sync-pulse { to { opacity: .35; transform: scale(.72); } }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { padding: 24px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-intro, .sidebar-note { display: none; }
  .filter-nav { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
  .filter-button { justify-content: center; gap: 8px; }
  .filter-button > span { gap: 6px; }
  .content { padding-top: 32px; }
}

@media (max-width: 580px) {
  .topbar { padding: 0 16px; }
  .sync-state { display: none; }
  .theme-toggle { min-width: 42px; padding: 0; }
  .theme-label { display: none; }
  .sidebar { padding: 12px; }
  .filter-nav { gap: 2px; }
  .filter-button { min-height: 40px; padding: 0 6px; font-size: 11px; }
  .filter-button b { display: none; }
  .content { padding: 24px 16px 48px; }
  .content-header { align-items: flex-start; }
  .content-header .button { width: 42px; padding: 0; font-size: 0; }
  .content-header .button span { font-size: 20px; }
  .toolbar { grid-template-columns: 1fr; }
  .results-meta { align-items: flex-start; gap: 12px; }
  .results-meta p:last-child { text-align: right; }
  .skill-card { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
  .skill-glyph { width: 36px; height: 36px; }
  .skill-card .toggle-button { grid-column: 1 / -1; width: 100%; }
  .skill-card .skill-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .skill-card .skill-actions .toggle-button { grid-column: auto; }
  .skill-title-row { align-items: flex-start; }
  .status-badge { display: none; }
  .detail-panel { min-height: calc(100vh - 32px); }
  .detail-header { padding: 24px 20px 16px; }
  .detail-tabs { padding-inline: 20px; }
  .translation-note, .detail-loading { margin-inline: 20px; }
  .skill-document { padding-inline: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
