/* =========================
   TenFlick style.css
   NORMAL / CUTE / COOL
========================= */

* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #182230;
  --muted: #677489;
  --border: #d9e1eb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf1ff;
  --success: #16865b;
  --danger: #c44242;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.10);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --key-shadow: 0 5px 0 rgba(37, 99, 235, 0.13);
  --font: "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
}

body.theme-normal {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #182230;
  --muted: #677489;
  --border: #d9e1eb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf1ff;
  --key-shadow: 0 5px 0 rgba(37, 99, 235, 0.13);
}

body.theme-cute {
  --bg: #fff4f8;
  --surface: #fffafd;
  --surface-2: #fff0f6;
  --text: #49313f;
  --muted: #8a6577;
  --border: #f1cfe0;
  --accent: #e75b96;
  --accent-strong: #c9437c;
  --accent-soft: #ffe2ef;
  --key-shadow: 0 5px 0 rgba(231, 91, 150, 0.14);
}

body.theme-cool {
  --bg: #0d1420;
  --surface: #151f2d;
  --surface-2: #101a27;
  --text: #eaf3ff;
  --muted: #9fb0c4;
  --border: #2d4055;
  --accent: #27c6e6;
  --accent-strong: #0fa7c6;
  --accent-soft: #123a46;
  --key-shadow: 0 5px 0 rgba(39, 198, 230, 0.15);
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 31rem),
    var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.eyebrow,
.sectionLabel {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* =========================
   Theme select
========================= */

.themeSelectBox {
  width: min(980px, 100%);
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  text-align: center;
}

.brandTitle {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.themeSelectTitle {
  margin: 26px 0 6px;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 800;
}

.themeSelectDescription {
  margin: 0;
  color: var(--muted);
}

.themeChoices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 34px 0 22px;
}

.themeCard {
  min-height: 225px;
  padding: 24px;
  border: 2px solid transparent;
  border-radius: 22px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.themeCard:hover {
  transform: translateY(-4px);
}

.themeCard.selected {
  border-color: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 13%, transparent);
}

.theme-normal-preview {
  color: #1f5fc8;
  background: #f4f8ff;
}

.theme-cute-preview {
  color: #d94d8a;
  background: #fff1f7;
}

.theme-cool-preview {
  color: #43d4f2;
  background: #111c29;
}

.themeCardName,
.themeCardSub {
  display: block;
}

.themeCardName {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.themeCardSub {
  margin-top: 4px;
  opacity: 0.8;
  font-size: 0.88rem;
}

.themeMiniKeyboard {
  width: min(150px, 100%);
  margin: 20px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.themeMiniKeyboard span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 12%, white);
  font-weight: 800;
}

.theme-cool-preview .themeMiniKeyboard span {
  background: rgba(67, 212, 242, 0.11);
}

.selectedThemeLine {
  color: var(--muted);
}

.selectedThemeLine strong {
  color: var(--text);
}

/* =========================
   Buttons
========================= */

.primaryButton,
.subButton,
.modeButton {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.primaryButton {
  padding: 14px 28px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 26%, transparent);
}

.primaryButton:hover,
.subButton:hover,
.modeButton:hover {
  transform: translateY(-1px);
}

.primaryButton:hover {
  background: var(--accent-strong);
}

.subButton,
.modeButton {
  padding: 10px 15px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
}

.modeButton.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* =========================
   App shell
========================= */

.appShell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.appHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.appHeader h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.headerActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.statusBadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.statusBadge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa6b4;
}

.statusBadge.connected {
  color: var(--success);
}

.statusBadge.connected::before {
  background: var(--success);
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  box-shadow: var(--shadow);
}

.introPanel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 22px 26px;
}

.introPanel h2 {
  margin: 0 0 7px;
  font-size: 1.15rem;
}

.introPanel p {
  margin: 0;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-2);
  text-align: center;
  font-family: inherit;
  font-weight: 800;
}

.selectedRowChip {
  flex: 0 0 auto;
  min-width: 160px;
  padding: 11px 15px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  text-align: center;
  font-weight: 900;
}

.mainGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 20px;
}

.inputPanel,
.guidePanel,
.keypadPanel,
.quickHelpPanel {
  padding: 26px;
}

.panelHeading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panelHeading h2 {
  margin: 0;
  font-size: 1.3rem;
}

.panelNote,
.counter {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

#inputArea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-2);
  font-size: 1.2rem;
  line-height: 1.75;
  caret-color: var(--accent);
}

#inputArea:focus {
  border-color: var(--accent);
}

#inputArea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.buttonRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.helpText,
.guideHint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

/* =========================
   Flick guide
========================= */

.flickGuide {
  width: min(350px, 100%);
  margin: 18px auto 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    ". up ."
    "left center right"
    ". down .";
  gap: 10px;
}

.guide-up { grid-area: up; }
.guide-left { grid-area: left; }
.guide-center { grid-area: center; }
.guide-right { grid-area: right; }
.guide-down { grid-area: down; }

.guideKey {
  min-height: 82px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  box-shadow: var(--key-shadow);
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.guideKey:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.guideKey:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.guideKey span,
.guideKey strong {
  display: block;
}

.guideKey span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.guideKey strong {
  margin-top: 4px;
  font-size: 1.5rem;
}

/* =========================
   Ten key
========================= */

.keypadPanel {
  margin-top: 20px;
}

.keyboardArea {
  display: grid;
  grid-template-columns: minmax(300px, 520px) minmax(190px, 260px);
  justify-content: center;
  gap: 22px;
}

.tenKeyGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rowKey,
.editKey {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  box-shadow: var(--key-shadow);
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.rowKey {
  min-height: 82px;
  padding: 9px;
  border-radius: 14px;
}

.rowKey:hover,
.editKey:hover,
.rowKey.active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.rowKey.active {
  color: var(--accent);
}

.rowKey span,
.rowKey strong,
.editKey span,
.editKey strong,
.editKey small {
  display: block;
}

.rowKey span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.rowKey strong {
  margin-top: 3px;
  font-size: 1.55rem;
}

.wideZero {
  grid-column: span 2;
}

.editKeys {
  display: grid;
  gap: 12px;
  align-content: start;
}

.editKey {
  min-height: 110px;
  padding: 16px;
  border-radius: 16px;
  text-align: left;
}

.editKey span {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 900;
}

.editKey strong {
  margin: 4px 0;
  font-size: 1.2rem;
}

.editKey small {
  color: var(--muted);
}

/* =========================
   Quick help
========================= */

.quickHelpPanel {
  margin-top: 20px;
}

.quickHelpPanel h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

.quickHelpGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.quickHelpGrid div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.quickHelpGrid strong,
.quickHelpGrid span {
  display: block;
}

.quickHelpGrid strong {
  margin-bottom: 6px;
  color: var(--accent);
}

.quickHelpGrid span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* =========================
   Responsive
========================= */

@media (max-width: 900px) {
  .themeChoices,
  .mainGrid,
  .keyboardArea,
  .quickHelpGrid {
    grid-template-columns: 1fr;
  }

  .themeCard {
    min-height: 190px;
  }

  .themeMiniKeyboard {
    width: 130px;
  }

  .mainGrid {
    gap: 16px;
  }

  .keyboardArea {
    max-width: 560px;
    margin: 0 auto;
  }

  .editKeys {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 650px) {
  .screen {
    padding: 20px 12px;
  }

  .themeSelectBox {
    padding: 28px 18px;
    border-radius: 24px;
  }

  .appShell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .appHeader,
  .introPanel {
    align-items: flex-start;
    flex-direction: column;
  }

  .headerActions {
    justify-content: flex-start;
  }

  .selectedRowChip {
    min-width: 0;
  }

  .inputPanel,
  .guidePanel,
  .keypadPanel,
  .quickHelpPanel {
    padding: 18px;
  }

  .panelHeading {
    flex-direction: column;
  }

  .tenKeyGrid {
    gap: 8px;
  }

  .rowKey {
    min-height: 70px;
  }

  .rowKey strong {
    font-size: 1.35rem;
  }

  .guideKey {
    min-height: 72px;
  }

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

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