/* Owner: base. Component states and responsive rules live here. See AGENTS.md. */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Inter", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
  color: inherit;
}

input {
  font: inherit;
}

select {
  font: inherit;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111;
  color: var(--text);
  padding: 0 10px;
}

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

h1 {
  margin-bottom: 0;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.utility-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.shortcut-key {
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border: 1px solid #4f5660;
  background: #1a1e23;
  color: #b9c1ca;
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.utility-button:disabled .shortcut-key {
  border-color: #343a41;
  background: #15181c;
  color: #676e77;
}

.outline-button {
  width: 100%;
}

.utility-button:disabled,
.outline-button:disabled {
  border-color: var(--line);
  cursor: not-allowed;
}

.utility-button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.utility-button.primary:hover,
.utility-button.primary:focus-visible {
  border-color: #4dffa9;
  background: #4dffa9;
  color: var(--accent-contrast);
}

.utility-button.primary:disabled {
  border-color: #244134;
  background: #16251e;
  color: #61766c;
}

.utility-button.danger {
  border-color: #ff5278;
  background: rgba(255, 54, 91, 0.13);
  color: #ff7895;
}

.utility-button.danger:hover:not(:disabled),
.utility-button.danger:focus-visible:not(:disabled) {
  border-color: #ff8aa3;
  background: rgba(255, 54, 91, 0.22);
  color: #ffa0b4;
}

.utility-button.danger:disabled {
  border-color: #3a292e;
  background: #171214;
  color: #674852;
}

.utility-button svg,
.outline-button svg {
  width: 16px;
  height: 16px;
}

.compact-panel h2 {
  margin-bottom: 18px;
}

.panel-title-row {
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title-row h2,
.panel-title-row p {
  margin-bottom: 0;
}

.range {
  width: 100%;
}

.range:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

#cumulative-axp,
#next-axp {
  color: var(--green);
}

.select-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.select-field span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

select option {
  background: #111;
  color: var(--text);
}

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

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

  .utility-button {
    min-width: 0;
  }
}

html:is([data-theme="light"],[data-theme="dark"]) .panel {
  background: var(--custom-tab-bg);
}

html:root body {
  font: 14px/1.55 'Inter','Noto Sans KR','Malgun Gothic',sans-serif;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
}

html:root :is(h1,h2,h3,p),
html:root :is(button,input,select,textarea) {
  font-family: inherit;
}

html:root button {
  cursor: pointer;
}

html:root button:disabled {
  cursor: not-allowed;
}

html:root :is(button,input,select,textarea,a,[tabindex]):focus-visible {
  outline: 2px solid var(--focus-blue);
  outline-offset: 2px;
}

html:root :is(input,select,textarea) {
  accent-color: var(--green);
  color: var(--text);
}

html:root :is(input:not([type=range]):not([type=checkbox]):not([type=radio]),select,textarea) {
  border-color: var(--pencil-soft);
  background-color: var(--input-bg);
  border-radius: var(--radius-sm);
}

html:root :is(input,select,textarea)::placeholder {
  color: var(--ink-subtle);
}

html:root :is(input,select,textarea):disabled {
  opacity: .45;
  background-color: var(--paper-muted);
  color: var(--ink-subtle);
}

html:root .panel {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

html:root .panel h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.035em;
}

html:root .utility-button,
html:root .outline-button {
  min-height: 38px;
  border: 1px solid var(--pencil-soft);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: var(--input-bg);
  color: var(--text);
  box-shadow: var(--shadow-control);
  font: 700 12px/1.4 'Inter','Noto Sans KR',sans-serif;
  transition: background .12s,border-color .12s;
}

html:root .utility-button:is(:hover,:focus-visible):not(:disabled),
html:root .outline-button:is(:hover,:focus-visible):not(:disabled) {
  background: color-mix(in srgb,var(--input-bg) 58%,var(--paper-raised));
  border-color: var(--pencil-strong);
  color: var(--text);
}

html:root .utility-button:active:not(:disabled),
html:root .outline-button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

html:root body button.selection-feedback:not(:disabled,[data-selection-feedback="off"]),
html:root body button:is([aria-pressed],[aria-checked],[aria-selected]):active:not(:disabled,[data-selection-feedback="off"]) {
  border-color: var(--pencil-strong) !important;
  background: var(--highlighter-yellow-soft) !important;
  color: var(--ink-strong) !important;
  transition: none !important;
}

html:root .utility-button.primary:not(:disabled) {
  background: var(--green);
  border-color: var(--brand-green-dark);
  color: #fff;
}

html:root .utility-button.danger:not(:disabled) {
  background: var(--danger-soft);
  border-color: rgba(198,91,98,.35);
  color: #8F3E46;
}

html:root .utility-button.small {
  min-height: 34px;
  font-size: 11px;
  padding: 6px 9px;
}

html:root .utility-button:disabled,
html:root .outline-button:disabled {
  opacity: .45;
  background: var(--paper-muted);
  color: var(--ink-subtle);
  box-shadow: none;
}

html:root .shortcut-key {
  display: none;
}

@keyframes archetype-pencil-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
*::before,
*::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
