:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #000;
  color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: #000;
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.045), transparent 36%),
    #000;
}

.stage {
  position: relative;
  display: grid;
  align-items: start;
  justify-items: center;
  min-height: 0;
  padding: 12px 16px 8px;
}

.teaching-panel {
  display: grid;
  width: 100%;
  height: 100%;
  align-items: start;
  justify-items: center;
}

.teaching-panel[hidden] {
  display: none;
}

.idle-center {
  display: block;
}

.writer-wrap {
  position: relative;
  width: min(94vw, calc(100vh - 104px), 820px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.025);
}

.grid-lines {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(255, 255, 255, 0.16) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent calc(50% - 0.5px), rgba(255, 255, 255, 0.16) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(45deg, transparent calc(50% - 0.5px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(-45deg, transparent calc(50% - 0.5px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 0.5px));
}

.writer-canvas {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.writer-canvas > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fallback-char {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #fff;
  font-size: min(72vw, calc((100vh - 104px) * 0.72), 560px);
  font-weight: 700;
  line-height: 1;
}

.controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 340px);
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.82);
  color: rgba(255, 255, 255, 0.66);
}

.status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.status-dot--on {
  background: #7dd3fc;
}

.transcript {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.42);
  text-overflow: ellipsis;
}

.toolbar-message {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  text-overflow: ellipsis;
}

.actions,
.manual-form {
  display: flex;
  gap: 10px;
}

button {
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  background: rgba(255, 255, 255, 0.16);
}

input {
  width: 100%;
  height: 40px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: rgba(125, 211, 252, 0.6);
}

@media (max-width: 760px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .actions,
  .manual-form {
    width: 100%;
  }

  .actions button,
  .manual-form button {
    flex: 1;
  }

  .writer-wrap {
    width: min(94vw, calc(100vh - 224px));
  }
}
