:root {
  color-scheme: dark;
  --bg: #151618;
  --panel: #22262a;
  --panel-2: #2d3337;
  --line: #485058;
  --text: #f2f5f6;
  --muted: #aab3ba;
  --green: #34c47c;
  --amber: #f6b13d;
  --red: #e35f5f;
  --cyan: #4eb9d8;
  --ink: #0d1012;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #0f1113;
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

body {
  display: grid;
  place-items: center;
  padding: 18px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #323940;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  background: #3d464d;
}

button.active,
button.primary,
.primary {
  background: var(--green);
  border-color: #56d092;
  color: #06130c;
  font-weight: 700;
}

button.start {
  background: var(--amber);
  color: #1f1402;
  font-weight: 800;
}

button.stop,
button.danger {
  background: var(--red);
  color: #1d0505;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161a1d;
  color: var(--text);
  padding: 8px 10px;
}

.shell {
  width: min(1220px, 100%);
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 320px;
  gap: 14px;
}

.device-frame {
  border: 2px solid #555d63;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b4145 0%, #202326 100%);
  padding: 14px;
  min-width: 0;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.35);
}

.brand-strip {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid #5f686f;
  border-radius: 8px;
  background: #262b2f;
}

.brand-strip span,
.section-head span,
.demo-note,
.product-info small {
  color: var(--muted);
  font-size: 12px;
}

.panel-mark {
  width: 76px;
  height: 36px;
}

.status-pill {
  margin-left: auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: #163628;
  color: #8df0bd;
  border: 1px solid #2b7d56;
  font-size: 12px;
  font-weight: 700;
}

.screen {
  margin-top: 14px;
  aspect-ratio: 16 / 9;
  min-height: 430px;
  border: 2px solid #0b0d0f;
  border-radius: 8px;
  background: var(--bg);
  display: grid;
  grid-template-rows: 54px 56px 1fr;
  overflow: hidden;
}

.topbar,
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #2f363b;
}

.topbar {
  justify-content: space-between;
  background: #1b2024;
}

.topbar div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.topbar strong {
  font-size: 20px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mode-switch button {
  min-width: 76px;
}

.main-nav {
  background: #20262b;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.view {
  display: none;
  padding: 14px;
  min-height: 0;
}

.active-view {
  display: block;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.big-action {
  height: 112px;
  font-size: 22px;
  font-weight: 800;
}

.home-status {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-status div,
.numeric-block,
.product-info,
.panel-section,
.menu-panel,
.keyboard-panel,
.recipe-form {
  border: 1px solid #3b444a;
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.home-status span,
.numeric-block span,
label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.home-status strong,
.numeric-block strong {
  display: block;
  font-size: 22px;
}

.cook-layout,
.editor-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

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

.menu-item {
  min-height: 48px;
  text-align: left;
  padding: 0 12px;
}

.menu-item.selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 2px rgba(78, 185, 216, 0.35);
}

.cook-controls,
.keyboard-panel,
.recipe-form {
  display: grid;
  gap: 10px;
}

.numeric-block div,
.row-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.numeric-block strong {
  text-align: center;
  color: #fff;
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.keyboard button {
  min-height: 38px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.side-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.status-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #3a4248;
  padding-bottom: 6px;
}

.status-list dt,
.status-list dd {
  margin: 0;
}

.status-list dt {
  color: var(--muted);
}

.uart-log {
  height: 330px;
  overflow: auto;
  margin: 0;
  padding-left: 20px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.uart-log li {
  margin-bottom: 8px;
  color: #d7e3e7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 20px;
}

.modal {
  width: min(420px, 100%);
  border: 1px solid #68737b;
  border-radius: 8px;
  background: #20262b;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.48);
}

.modal strong {
  display: block;
  font-size: 22px;
  margin-bottom: 10px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  body {
    place-items: stretch;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .screen {
    aspect-ratio: auto;
  }
}

@media (max-width: 720px) {
  .main-nav,
  .home-grid,
  .home-status,
  .cook-layout,
  .editor-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .screen {
    grid-template-rows: auto auto 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}
