*,
*:before,
*:after {
  box-sizing: border-box;
}
html, body {
  height: 100%;
  margin: 0;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f7f7;
  color: #222;
}
.stage {
  min-height: calc(100vh - var(--settings-offset, 160px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background-color: #fff0f3;
  background-image:
    linear-gradient(0deg, rgba(229,221,225,0.75) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229,221,225,0.75) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center;
  transition: min-height 0.32s ease;
}
.logo {
  position: fixed;
  top: 12px;
  left: 12px;
  height: 40px;
  width: auto;
  z-index: 1100;
}
.display {
  text-align: center;
}
.current-name-wrap {
  width: var(--name-diameter, 420px);
  height: var(--name-diameter, 420px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,0.02);
}
#current-name {
  font-size: 80px;
  font-weight: 800;
  color: #d94b83;
  min-height: 1.6em;
  width: 80%;
  line-height: 1.1;
  word-break: break-all;
  white-space: normal;
}
.controls-floating {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 140px;
  display: flex;
  justify-content: center;
  gap: 12px;
  z-index: 1000;
  transition: bottom 0.32s ease;
}
.controls-floating button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
}
.controls-floating #btn-toggle {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
  box-shadow: 0 6px 16px rgba(26,115,232,0.3);
}
.controls-floating #btn-toggle:hover {
  background: #1769d9;
  border-color: #1769d9;
}
.controls-floating #btn-restart {
  background: #ea4335;
  border-color: #ea4335;
  color: #fff;
  box-shadow: 0 6px 16px rgba(234,67,53,0.3);
}
.controls-floating #btn-restart:hover {
  background: #d43c30;
  border-color: #d43c30;
}
.controls-floating #btn-toggle-settings {
  background: #34a853;
  border-color: #34a853;
  color: #fff;
  box-shadow: 0 6px 16px rgba(52,168,83,0.3);
}
.controls-floating #btn-toggle-settings:hover {
  background: #2f9450;
  border-color: #2f9450;
}
.controls-floating button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
#viz-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#picked-list {
  position: absolute;
  right: 20px;
  top: 20px;
  max-height: calc(100% - 180px);
  overflow: auto;
  background: rgba(255,255,255,0.96);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 220px;
  font-size: 16px;
  line-height: 1.5;
  color: #1f2937;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.picked-list-header {
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}
.picked-item {
  padding: 6px 8px;
  border-bottom: 1px dashed #ddd;
}
.picked-group {
  white-space: nowrap;
  overflow-x: auto;
  padding: 6px 0;
  border-bottom: 1px dashed #eee;
}
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  font-size: 14px;
  margin-right: 6px;
}
.settings-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid #e5e7eb;
  backdrop-filter: saturate(1.2) blur(6px);
  z-index: 900;
  transition: transform 0.32s ease;
}
.settings-handle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.settings-handle .arrow {
  width: 12px;
  height: 12px;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(45deg);
  transition: transform 0.25s ease, border-color 0.2s ease;
}
body.settings-collapsed .settings-handle .arrow {
  transform: rotate(225deg);
}
.settings-peek {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  width: 56px;
  height: 8px;
  border-radius: 999px;
  background: #d1d5db;
  z-index: 950;
  display: none;
  cursor: pointer;
}

body.settings-collapsed .settings-bar {
  transform: translateY(100%);
}
body.settings-collapsed .settings-peek {
  display: block;
}
body.settings-collapsed .controls-floating {
  bottom: 40px;
}
.settings-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
}
#app .settings-inner .left {
  max-width: 560px;
}
#names-input {
  width: 560px;
  max-width: 100%;
  height: 96px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  resize: vertical;
}
.right .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.right button {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  cursor: pointer;
}
.right button:hover {
  background: #e5e7eb;
  border-color: #cfd4da;
}
.right button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.small {
  font-size: 12px;
  color: #666;
}
@media (max-width: 768px) {
  .settings-inner {
    grid-template-columns: 1fr;
  }
}
