﻿/* Base variables, shared typography, and original landing styles. */
:root {
  color-scheme: light;
  --body-font: "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --title-font: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --brand-green: #0f6842;
  --landing-title: #0e1512;
  --landing-copy: #526273;
  --line: #2f2516;
  --wood: #d8a45d;
  --wood-dark: #b47a32;
  --board-wood-bg:
    linear-gradient(rgba(245, 210, 142, 0.20), rgba(245, 210, 142, 0.20)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(90deg, rgba(255, 240, 192, 0.20), rgba(109, 70, 27, 0.04)),
    url("./assets/board-wood-texture-kaya-light.jpg") center / cover no-repeat,
    var(--wood);
  --ink: #1f2933;
  --muted: #65758a;
  --panel: #ffffff;
  --bg: #eef3f6;
  --accent: #1976d2;
  --accent-dark: #155fa8;
  --soft-line: #d8e2eb;
  --soft-panel: #f7fafc;
  --danger: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
}

.auth-brand-text strong,
.auth-feature-band strong,
h1,
h2,
h3,
.auth-best-answer strong,
.qa-section-header strong,
.qa-question-row h3,
.qa-answerer-profile-panel h2 {
  font-family: var(--title-font);
}

p,
.auth-hero p,
.auth-feature-band p,
.auth-question-card p,
.auth-best-answer p,
.qa-question-row p,
.qa-detail-body,
.qa-answer-card p,
.qa-message {
  font-family: var(--body-font);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  /* Keep the logged-out landing above the authenticated mobile header/nav. */
  z-index: 200;
  display: block;
  padding: 22px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.04), rgba(246, 250, 247, 0.18)),
    url("./assets/top-background-igo-cloud.png") center / 100% 100% no-repeat,
    #eef3f6;
}

/* Page-specific bundles such as Home and Q&A may omit styles.app.css.
   Keep the shared visibility utility in the base bundle. */
.hidden {
  display: none !important;
}

.auth-landing {
  width: min(1180px, 100%);
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
}

.auth-landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 4px;
}

.auth-landing-nav nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.auth-landing-nav nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid rgba(68, 88, 100, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.74);
  color: #365c45;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(61, 75, 86, 0.06);
}

.auth-hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(380px, 0.96fr);
  gap: 22px;
  align-items: center;
}

.auth-hero-copy {
  display: grid;
  align-content: center;
  gap: 15px;
  padding: 14px 0 20px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  letter-spacing: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-brand-wordmark {
  display: block;
  width: min(286px, 48vw);
  height: auto;
  max-height: 58px;
  object-fit: contain;
}

.auth-kicker {
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid rgba(54, 92, 69, 0.2);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: #365c45;
  font-size: 12px;
  font-weight: 950;
}

.auth-hero h1 {
  max-width: 640px;
  margin: 0;
  color: #17231d;
  font-size: 46px;
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-hero p {
  max-width: 660px;
  margin: 0;
  color: #4b5b67;
  font-size: 16px;
  line-height: 1.75;
}

.auth-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.auth-primary-link,
.auth-secondary-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 950;
  text-decoration: none;
}

.auth-action-icon {
  position: relative;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
}

.auth-primary-link .auth-action-icon {
  border: 1px solid rgba(15, 104, 66, 0.24);
  background: #0f6842;
  color: #fff;
}

.auth-secondary-link .auth-action-icon {
  border: 1px solid rgba(15, 104, 66, 0.24);
  background: #0f6842;
  color: #fff;
}

.auth-action-icon.search::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  transform: translate(-1px, -1px);
}

.auth-action-icon.search::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(5px, 5px) rotate(45deg);
}

.auth-action-icon.board::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 1px solid currentColor;
  background:
    linear-gradient(to right, transparent 31%, currentColor 31%, currentColor 36%, transparent 36%, transparent 64%, currentColor 64%, currentColor 69%, transparent 69%),
    linear-gradient(to bottom, transparent 31%, currentColor 31%, currentColor 36%, transparent 36%, transparent 64%, currentColor 64%, currentColor 69%, transparent 69%);
}

.auth-action-icon.board::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.auth-primary-link {
  border: 1px solid #cbd7e2;
  background: rgba(255, 253, 248, 0.82);
  color: #365c45;
  box-shadow: 0 8px 18px rgba(54, 92, 69, 0.08);
}

.auth-secondary-link {
  border: 1px solid #cbd7e2;
  background: rgba(255, 253, 248, 0.82);
  color: #365c45;
}

.auth-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 660px;
}

.auth-hero-metrics span {
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  border: 1px solid rgba(68, 88, 100, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  color: #65758a;
  font-size: 13px;
  font-weight: 850;
}

.auth-hero-metrics strong {
  color: #17231d;
}

.auth-right-column {
  display: grid;
  gap: 12px;
}

.auth-preview-panel,
.auth-dialog,
.auth-feature-band article {
  border: 1px solid rgba(68, 88, 100, 0.24);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 3px 0 rgba(22, 34, 42, 0.14), 0 5px 8px rgba(31, 45, 55, 0.12);
}

.auth-preview-panel {
  display: grid;
  gap: 9px;
  padding: 12px 14px 14px;
}

.auth-preview-header,
.auth-best-answer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-preview-header {
  min-height: 18px;
  line-height: 1.1;
}

.auth-preview-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.auth-preview-header strong {
  color: #1976d2;
  font-size: 13px;
}

.auth-best-answer strong {
  font-weight: 900;
}

.auth-best-answer-heading {
  margin-top: 2px;
  color: #17231d;
}

.auth-best-answer-heading strong {
  font-size: 14px;
}

.auth-best-answer-heading strong span,
.auth-best-answer-heading > span {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 800;
}

.auth-preview-body {
  display: grid;
  grid-template-columns: minmax(190px, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
}

.auth-board-frame {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 18px auto;
  gap: 4px;
  align-items: stretch;
  min-width: 0;
}

.auth-board-coords {
  color: #6b512f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.86;
}

.auth-board-cols {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(19, minmax(0, 1fr));
  align-items: end;
  text-align: center;
}

.auth-board-rows {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(19, minmax(0, 1fr));
  align-items: center;
  justify-items: end;
  padding-right: 2px;
}

.auth-mini-board {
  --board-edge: calc(50% / 19);
  --line-gap: calc(100% / 18);
  --stone-size: calc(97% / 19);
  grid-column: 2;
  grid-row: 2;
  position: relative;
  aspect-ratio: 1;
  min-height: 190px;
  overflow: hidden;
  border: 0;
  background: var(--board-wood-bg);
  box-shadow:
    inset 0 0 0 999px rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(49, 38, 20, 0.12);
}

.auth-mini-board::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: var(--board-edge);
  background:
    linear-gradient(to right, rgba(80, 52, 20, 0.72) 1px, transparent 1px) 0 0 / var(--line-gap) var(--line-gap),
    linear-gradient(to bottom, rgba(80, 52, 20, 0.72) 1px, transparent 1px) 0 0 / var(--line-gap) var(--line-gap);
  box-shadow: inset -1px 0 0 rgba(80, 52, 20, 0.72), inset 0 -1px 0 rgba(80, 52, 20, 0.72);
  pointer-events: none;
}

.auth-mini-board .stone,
.auth-mini-board .candidate-dot,
.auth-mini-board .star-point {
  position: absolute;
  left: calc(((var(--x) + 0.5) * 100%) / 19);
  top: calc(((var(--y) + 0.5) * 100%) / 19);
  transform: translate(calc(-50% + 0.5px), -50%);
}

.auth-mini-board .stone,
.auth-mini-board .candidate-dot {
  z-index: 3;
  width: var(--stone-size);
  height: var(--stone-size);
  max-width: none;
  max-height: none;
  border-radius: 50%;
}

.auth-mini-board .stone {
  transform: translate(calc(-50% + 0.5px), calc(-50% + 1px));
}

.auth-mini-board .star-point {
  z-index: 1;
  width: 1.55%;
  height: 1.55%;
  max-width: 5px;
  max-height: 5px;
  min-width: 2.5px;
  min-height: 2.5px;
  border-radius: 50%;
  background: rgba(66, 43, 17, 0.86);
}

.auth-mini-board .stone.black {
  background: url("./assets/go-stones/black-stone.svg") center / contain no-repeat;
  box-shadow: none;
}

.auth-mini-board .stone.white {
  border: 0;
  background: url("./assets/go-stones/white-stone.svg") center / contain no-repeat;
  box-shadow: none;
}

.auth-mini-board .s1 { --x: 3; --y: 3; }
.auth-mini-board .s2 { --x: 15; --y: 3; }
.auth-mini-board .s3 { --x: 14; --y: 5; }
.auth-mini-board .s4 { --x: 3; --y: 15; }
.auth-mini-board .s5 { --x: 10; --y: 9; }

.auth-mini-board .candidate-dot {
  --x: 11;
  --y: 8;
  z-index: 4;
  display: grid;
  place-items: center;
  border: 2px solid #1976d2;
  background: rgba(255, 253, 248, 0.86);
  color: #1976d2;
  font-size: 12px;
  font-weight: 950;
}

.auth-question-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.auth-question-card h2 {
  margin: 0;
  color: #17231d;
  font-size: 19px;
  line-height: 1.35;
}

.auth-question-card p,
.auth-best-answer p {
  margin: 0;
  color: #4b5b67;
  font-size: 13px;
  line-height: 1.55;
}

.auth-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-ai-chips span {
  padding: 5px 8px;
  border: 1px solid #cbe0f3;
  border-radius: 999px;
  background: #eef6ff;
  color: #155fa8;
  font-size: 12px;
  font-weight: 900;
}

.auth-best-answer {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #d8e3ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.auth-best-author {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.auth-best-author img {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.auth-best-author strong {
  color: #17231d;
  font-size: 13px;
}

.auth-best-author strong span {
  margin-left: 5px;
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 800;
}

.auth-read-more {
  justify-self: end;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid rgba(15, 104, 66, 0.42);
  border-radius: 999px;
  background: #fffdfa;
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.auth-dialog {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.auth-dialog h2 {
  margin-bottom: 4px;
}

.auth-dialog p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-dialog label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-dialog input {
  width: 100%;
  border: 1px solid #cbd7e2;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.auth-dialog button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.auth-register-link {
  justify-self: start;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.auth-message {
  min-height: 20px;
  color: var(--danger) !important;
  font-weight: 800;
}

.auth-message[data-state="ok"] {
  color: #1b7f45 !important;
}

.auth-feature-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 6px;
}

.auth-feature-band article {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
}

.auth-feature-band article > span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f6;
  color: #365c45;
  font-size: 11px;
  font-weight: 950;
}

.auth-feature-band strong {
  margin: 0;
  color: var(--brand-green);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.28;
}

.auth-feature-band p {
  margin: 0;
  color: var(--landing-copy);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.42;
  text-align: left;
}

@media (max-width: 920px) {
  .auth-overlay {
    align-items: start;
    padding: 14px;
  }

  .auth-landing-nav {
    align-items: start;
    flex-direction: column;
  }

  .auth-landing-nav nav {
    justify-content: flex-start;
  }

  .auth-landing {
    gap: 14px;
  }

  .auth-hero {
    grid-template-columns: 1fr;
  }

  .auth-hero h1 {
    font-size: 32px;
  }

  .auth-hero p {
    font-size: 14px;
  }

  .auth-preview-body,
  .auth-feature-band,
  .auth-hero-metrics {
    grid-template-columns: 1fr;
  }

  .auth-mini-board {
    min-height: 0;
  }

  .auth-dialog {
    padding: 20px;
  }
}

/* Site-wide first-paint guard. Keep layout measurable while initialization runs. */
html.site-booting,
html.site-booting body {
  min-height: 100%;
  background: #f4f6f1;
}

html.site-booting body {
  overflow: hidden !important;
}

html.site-booting body > :not(.site-boot-screen) {
  visibility: hidden !important;
}

.site-boot-screen {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(191, 207, 184, 0.24), transparent 30%),
    radial-gradient(circle at 84% 78%, rgba(221, 204, 165, 0.2), transparent 32%),
    #f4f6f1;
  color: #233a2b;
  opacity: 1;
  transition: opacity 160ms ease;
}

.site-boot-screen::before,
.site-boot-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.site-boot-screen::before {
  width: 13px;
  height: 13px;
  top: max(10%, 52px);
  right: max(12%, 56px);
  background: #25352a;
  box-shadow: 0 4px 10px rgba(20, 32, 24, 0.18);
}

.site-boot-screen::after {
  width: 11px;
  height: 11px;
  bottom: max(11%, 52px);
  left: max(13%, 56px);
  border: 1px solid rgba(30, 45, 34, 0.18);
  background: #fff;
  box-shadow: 0 4px 10px rgba(20, 32, 24, 0.12);
}

.site-boot-screen.is-leaving {
  pointer-events: none;
  opacity: 0;
}

.site-boot-card {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 360px);
  padding: 24px 26px;
  border: 1px solid rgba(46, 69, 52, 0.09);
  border-radius: 22px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 18px 50px rgba(34, 50, 38, 0.08);
  backdrop-filter: blur(10px);
}

.site-boot-logo {
  display: block;
  width: min(268px, 78vw);
  height: auto;
}

.site-boot-progress {
  position: relative;
  width: 68px;
  height: 3px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(46, 74, 54, 0.13);
}

.site-boot-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #57745e;
  transform: translateX(-100%);
  animation: site-boot-progress 1.1s ease-in-out infinite;
}

.site-boot-message {
  margin: 11px 0 0;
  color: #657069;
  font: 600 12px/1.6 "Noto Sans JP", sans-serif;
  letter-spacing: 0.08em;
  text-align: center;
}

.site-boot-retry {
  margin-top: 16px;
  padding: 9px 18px;
  border: 1px solid #496750;
  border-radius: 999px;
  background: #496750;
  color: #fff;
  font: 700 13px/1.4 "Noto Sans JP", sans-serif;
  cursor: pointer;
}

.site-boot-retry:hover {
  background: #38543f;
}

.site-boot-retry:focus-visible {
  outline: 3px solid rgba(73, 103, 80, 0.24);
  outline-offset: 3px;
}

.site-boot-screen.has-error .site-boot-progress {
  display: none;
}

.site-boot-screen.has-error .site-boot-message {
  max-width: 30em;
  margin-top: 20px;
  color: #525d56;
  letter-spacing: 0;
}

@keyframes site-boot-progress {
  0% { transform: translateX(-100%); }
  48% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

@media (max-width: 540px) {
  .site-boot-card {
    width: min(100%, 300px);
    padding: 21px 20px;
    border-radius: 18px;
  }

  .site-boot-screen::before,
  .site-boot-screen::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-boot-screen {
    transition: none;
  }

  .site-boot-progress::after {
    transform: none;
    animation: none;
  }
}

html[data-ui-motion="off"] .site-boot-screen {
  transition: none;
}

html[data-ui-motion="off"] .site-boot-progress::after {
  transform: none;
  animation: none;
}

/* Keep the first-paint guard invisible during normal loading. */
.site-boot-screen {
  background: transparent;
  transition: none;
}

.site-boot-screen::before,
.site-boot-screen::after,
.site-boot-card {
  display: none;
}

.site-boot-screen.has-error {
  background: #f4f6f1;
}

.site-boot-screen.has-error .site-boot-card {
  display: grid;
}
