@import url("https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700&display=swap");

:root {
  --linest-bg: #fefefb;
  --linest-surface: #ffffff;
  --linest-text: #3e2f23;
  --linest-heading: #4a3728;
  --linest-muted: #6f6258;
  --linest-green: #257836;
  --linest-green-bright: #2f9e44;
  --linest-green-dark: #1d5e2a;
  --linest-green-soft: #f1f7ed;
  --linest-terracotta: #9c5230;
  --linest-terracotta-dark: #7e4227;
  --linest-warm: #d97c4b;
  --linest-border: #efe7d9;
  --linest-shadow:
    0 1px 2px rgba(74, 55, 40, 0.05),
    0 4px 14px rgba(74, 55, 40, 0.07),
    0 14px 30px rgba(74, 55, 40, 0.05);
  --linest-heading-font:
    "Zen Maru Gothic", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic", "Noto Sans JP", sans-serif;
  --linest-body-font:
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "Noto Sans JP", sans-serif;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.linest-themed {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--linest-text);
  font-family: var(--linest-body-font);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: rgba(47, 158, 68, 0.16);
}

body.linest-themed:not([class*="theme-"]) {
  background:
    radial-gradient(circle at 8% 4%, rgba(47, 158, 68, 0.12), transparent 30rem),
    radial-gradient(circle at 92% 18%, rgba(217, 124, 75, 0.12), transparent 26rem),
    var(--linest-bg);
}

/*
 * 訓練中の長押しによる選択・コピー・画像ドラッグを抑える。
 * 文字入力欄だけはカーソル操作を維持する。
 */
body.linest-themed,
body.linest-themed :where(
  button,
  a,
  img,
  svg,
  canvas,
  label,
  [role="button"],
  [draggable="true"],
  .card,
  .panel
) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.linest-themed :where(
  input:not([type]),
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="password"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="month"],
  input[type="week"],
  textarea,
  [contenteditable="true"],
  [contenteditable="plaintext-only"]
) {
  -webkit-user-select: text;
  user-select: text;
}

body.linest-themed :where(img, svg, canvas) {
  -webkit-user-drag: none;
  user-drag: none;
}

body.linest-themed :where(h1, h2, h3) {
  line-break: strict;
  overflow-wrap: normal;
  word-break: auto-phrase;
  hyphens: none;
  text-wrap: balance;
}

body.linest-themed :where(button, label, legend, .app-title, .linest-app-name) {
  line-break: strict;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  text-wrap: balance;
}

body.linest-themed :where(p, li, dd, .description, .help-text, .status-text) {
  line-break: strict;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

body.linest-themed :where(h1, h2, h3, .title, .app-title) {
  color: var(--linest-heading);
  font-family: var(--linest-heading-font);
  letter-spacing: 0.01em;
}

body.linest-themed h1 {
  font-size: clamp(1.65rem, 4vw, 2.1rem);
  line-height: 1.5;
}

body.linest-themed h2 {
  line-height: 1.55;
}

body.linest-themed :where(button, input, select, textarea) {
  max-width: 100%;
  border-radius: 8px;
  font: inherit;
}

body.linest-themed button,
body.linest-themed [role="button"] {
  min-height: 44px;
  touch-action: manipulation;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

body.linest-themed button:not(:disabled):active,
body.linest-themed [role="button"]:not([aria-disabled="true"]):active {
  transform: translateY(1px);
}

body.linest-themed :where(input, select, textarea) {
  border-color: var(--linest-border);
  background-color: #ffffff;
  color: var(--linest-text);
}

body.linest-themed :where(
  .primary,
  .primary-button,
  .primary-action,
  .check-button,
  .spin-button,
  .tool-button.primary,
  .action-button.primary
) {
  border-color: var(--linest-green) !important;
  background: var(--linest-green) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(47, 158, 68, 0.24);
}

body.linest-themed :where(
  .primary,
  .primary-button,
  .primary-action,
  .check-button,
  .spin-button,
  .tool-button.primary,
  .action-button.primary
):not(:disabled):hover {
  border-color: var(--linest-green-dark) !important;
  background: var(--linest-green-dark) !important;
  transform: translateY(-1px);
}

body.linest-themed :where(.secondary, .secondary-button, .sub-button) {
  border-color: var(--linest-terracotta) !important;
  background: var(--linest-terracotta) !important;
  color: #ffffff !important;
}

body.linest-themed :where(.secondary, .secondary-button, .sub-button):not(:disabled):hover {
  border-color: var(--linest-terracotta-dark) !important;
  background: var(--linest-terracotta-dark) !important;
}

body.linest-themed :where(
  .app-header,
  .topbar,
  .top-bar,
  .top-panel,
  .control-panel,
  .controls,
  .control-band,
  .settings-panel,
  .status-panel,
  .history-panel,
  .tool-card,
  .card
) {
  border-color: var(--linest-border);
  box-shadow: var(--linest-shadow);
}

body.linest-themed :where(.eyebrow, .section-kicker, .mini-label, .control-label) {
  color: var(--linest-green-dark);
  font-family: var(--linest-heading-font);
  font-weight: 700;
  letter-spacing: 0.04em;
}

body.linest-themed :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(47, 158, 68, 0.48);
  outline-offset: 3px;
}

.linest-skip-link {
  position: fixed;
  z-index: 100000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--linest-green-dark);
  box-shadow: var(--linest-shadow);
  transform: translateY(-160%);
}

body.linest-keyboard-nav .linest-skip-link:focus {
  transform: translateY(0);
}

.linest-app-bar {
  position: relative;
  z-index: 9990;
  width: 100%;
  background: linear-gradient(135deg, #4a3728, #5a4433);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(62, 47, 35, 0.16);
}

.linest-app-bar__inner {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  min-height: 74px;
  margin: 0 auto;
  padding: 10px 0;
}

.linest-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
}

.linest-brand__logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: #fefefb;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(25, 16, 10, 0.2);
}

.linest-brand__text {
  display: grid;
  line-height: 1.25;
}

.linest-brand__name {
  font-family: var(--linest-heading-font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.linest-brand__tagline {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 500;
}

.linest-app-identity {
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.linest-app-kicker {
  display: block;
  margin-bottom: 1px;
  color: #cce8cf;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.linest-app-name {
  display: block;
  overflow: hidden;
  color: #ffffff;
  font-family: var(--linest-heading-font);
  font-size: clamp(0.96rem, 2.2vw, 1.16rem);
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linest-app-list-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  font-family: var(--linest-heading-font);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.linest-app-list-link:hover {
  background: rgba(255, 255, 255, 0.17);
  transform: translateY(-1px);
}

.linest-utility-bar {
  position: relative;
  z-index: 9980;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: min(1180px, calc(100% - 32px));
  min-height: 54px;
  margin: 0 auto;
  padding: 7px 0;
}

.linest-utility-button {
  min-height: 40px !important;
  padding: 7px 13px;
  border: 1px solid var(--linest-green);
  border-radius: 8px;
  background: #ffffff;
  color: var(--linest-green-dark);
  font-family: var(--linest-heading-font);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 4px 12px rgba(74, 55, 40, 0.08);
}

.linest-utility-button[aria-pressed="true"] {
  background: var(--linest-green);
  color: #ffffff;
}

.linest-utility-button--quiet {
  border-color: var(--linest-border);
  color: var(--linest-muted);
}

.linest-stopwatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  border: 1px solid var(--linest-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--linest-shadow);
}

.linest-stopwatch__time {
  min-width: 72px;
  color: var(--linest-heading);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: center;
}

.linest-app-footer {
  width: 100%;
  margin-top: 32px;
  padding: 22px 16px 26px;
  border-top: 1px solid rgba(239, 231, 217, 0.88);
  background: rgba(255, 255, 255, 0.86);
  color: var(--linest-muted);
  font-size: 0.8rem;
  text-align: center;
}

.linest-app-footer p {
  margin: 0;
}

.linest-app-footer strong {
  color: var(--linest-heading);
  font-family: var(--linest-heading-font);
}

@media (max-width: 680px) {
  .linest-app-bar__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    width: min(100% - 20px, 1180px);
    min-height: 66px;
  }

  .linest-brand__logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .linest-brand__tagline,
  .linest-app-kicker {
    display: none;
  }

  .linest-app-identity {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 7px 0 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
  }

  .linest-app-name {
    font-size: 0.96rem;
    text-overflow: clip;
    white-space: normal;
    word-break: keep-all;
  }

  .linest-app-list-link {
    min-height: 40px;
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .linest-utility-bar {
    align-items: stretch;
    flex-direction: column;
    width: min(100% - 20px, 1180px);
    padding: 8px 0;
  }

  .linest-music-button {
    align-self: flex-end;
  }

  .linest-stopwatch {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  body.linest-themed :where(button, [role="button"]) {
    line-height: 1.35;
    word-break: keep-all;
  }
}

@media (max-width: 390px) {
  .linest-brand__name {
    font-size: 0.98rem;
  }

  .linest-app-list-link {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.linest-themed *,
  body.linest-themed *::before,
  body.linest-themed *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .linest-app-bar,
  .linest-utility-bar,
  .linest-app-footer,
  .linest-skip-link {
    display: none !important;
  }
}
