:root {
  color-scheme: dark;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #edf2f8;
  background: #11161d;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #8bb8ff; outline-offset: 2px; }
[hidden] { display: none !important; }

.app { width: min(1060px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.page-header { margin-bottom: 32px; }
.brand { display: block; margin-bottom: 20px; color: #8bb8ff; font-size: 14px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.25; letter-spacing: -.035em; }
.page-header p { margin-bottom: 0; color: #b9c4d1; font-size: 16px; line-height: 1.6; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 30px; border: 1px solid #364250; border-radius: 10px; background: #1c242e; }
.panel h2 { margin-bottom: 26px; font-size: 21px; line-height: 1.3; letter-spacing: -.025em; }
label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 700; }
.control-row { display: flex; gap: 10px; }
.control-row input { flex: 1 1 auto; width: 100%; min-width: 0; height: 48px; padding: 0 13px; border: 1px solid #536171; border-radius: 6px; background: #121820; color: #edf2f8; font-size: 14px; }
.control-row input::placeholder { color: #93a1b0; }
.control-row input[aria-invalid="true"] { border-color: #f17b83; }
.primary-button, .secondary-button { flex: 0 0 auto; min-height: 48px; padding: 0 17px; border-radius: 6px; font-size: 14px; font-weight: 700; transition: background .15s ease; }
.primary-button { border: 1px solid #548bf0; background: #3975df; color: #fff; }
.primary-button:hover { background: #4e88ee; }
.secondary-button { border: 1px solid #718096; background: #27323f; color: #e8f1ff; }
.secondary-button:hover { background: #354457; }
.help, .error { margin: 10px 0 0; color: #b9c4d1; font-size: 13px; line-height: 1.55; }
.error { color: #ff9ca2; }
.result { margin-top: 31px; padding-top: 26px; border-top: 1px solid #364250; }
.result .control-row input { background: #161e27; }

.setup-intro { margin-bottom: 22px; color: #b9c4d1; font-size: 14px; line-height: 1.6; }
.dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 26px; }
.dimensions div { padding: 15px 17px; border-radius: 7px; background: #283442; }
.dimensions dt { margin-bottom: 5px; color: #b9c4d1; font-size: 13px; }
.dimensions dd { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
.css-action { padding-top: 24px; border-top: 1px solid #364250; }
.css-action h3 { margin-bottom: 7px; font-size: 16px; }
.css-action p { margin-bottom: 18px; color: #b9c4d1; font-size: 13px; line-height: 1.6; }
.css-action .secondary-button { margin-right: 14px; }
.css-action a { display: inline-block; color: #8bb8ff; font-size: 13px; text-underline-offset: 3px; }
.css-action a:hover { color: #b6d2ff; }

.toast { position: fixed; z-index: 10; left: 50%; bottom: 22px; max-width: calc(100% - 32px); padding: 12px 17px; border: 1px solid #718096; border-radius: 6px; background: #354457; color: #fff; font-size: 14px; font-weight: 700; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 780px) {
  .app { padding-top: 36px; }
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app { width: min(480px, calc(100% - 28px)); padding-top: 28px; }
  .page-header { margin-bottom: 25px; }
  .brand { margin-bottom: 15px; }
  .page-header p { font-size: 14px; }
  .panel { padding: 22px; }
  .panel h2 { margin-bottom: 21px; }
  .control-row { flex-direction: column; }
  .control-row input, .control-row button { width: 100%; }
  .css-action .secondary-button { margin: 0 10px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
