/* ログインなしのお試しページ(/try/)。landing.css の上に重ねる。設計の意図は docs/seo-landing.md。 */

.lp .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lp .icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 冒頭 ---------- */

.try main {
  padding-block: clamp(28px, 4vw, 48px) clamp(56px, 8vw, 96px);
}

.try .try-intro h1 {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  line-height: 1.35;
}

.try .try-lead {
  margin-top: 6px;
  color: var(--muted);
}

.try .try-grid {
  margin-top: clamp(20px, 3vw, 32px);
  display: grid;
  gap: 40px;
}

@media (min-width: 960px) {
  .try .try-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: 0 48px;
    align-items: start;
  }

  .try .lexicon {
    position: sticky;
    top: 24px;
  }
}

/* ---------- 英文の切り替え ---------- */

.try .reading-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 8px 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}

.try .samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.try .samples label {
  position: relative;
  cursor: pointer;
}

.try .samples input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.try .samples span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.9375rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition-property: color, border-color;
  transition-duration: 150ms;
}

.try .samples label:hover span {
  color: var(--ink);
}

.try .samples input:checked + span {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--blue);
}

.try .samples input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
  border-radius: 4px;
}

.try .text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.try .text-button:hover {
  color: var(--blue-deep);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.try .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 1.125rem;
  cursor: pointer;
  transition-property: background-color, color;
  transition-duration: 150ms;
}

.try .icon-button:hover {
  background: var(--tint);
  color: var(--ink);
}

.lp button.button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  gap: 6px;
}

/* ---------- 自分の英文 ---------- */

.try .own {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.try .own[hidden] {
  display: none;
}

.try .own label {
  font-size: 0.875rem;
  font-weight: 700;
}

.try .own textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #b9cad6;
  border-radius: 8px;
  font-family: var(--sans-ja);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
}

.try .own textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}

.try .own textarea[aria-invalid="true"] {
  border-color: #b3261e;
}

.try .own-error {
  color: #b3261e;
  font-size: 0.875rem;
}

.try .own-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.try .own-note {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ---------- 英文と語 ---------- */

.try .page {
  min-height: 240px;
}

.try .page-body p {
  hyphens: manual;
}

.try .w {
  display: inline;
  margin: 0;
  padding: 0 0.04em;
  border: 0;
  border-radius: 3px;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .try .w:hover {
    background: var(--marker-soft);
  }
}

.try .w:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.try .w.picked {
  background-image: linear-gradient(var(--marker), var(--marker));
  background-repeat: no-repeat;
  background-position: 0 58%;
  background-size: 100% 78%;
  color: var(--ink);
}

.try .w.active,
.try .w.demo-hint {
  background-color: var(--marker-soft);
  box-shadow: inset 0 -2px 0 var(--ink);
}

/* 訳(押した語のすぐ下に浮かぶ) */
.try .gloss {
  position: absolute;
  z-index: 5;
  padding: 14px 16px 12px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgb(23 36 45 / 0.1),
    0 6px 16px -4px rgb(23 36 45 / 0.16),
    0 2px 4px rgb(23 36 45 / 0.06);
  font-family: var(--sans-ja);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink);
}

.try .gloss[hidden] {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .try .gloss:not([hidden]) {
    animation: try-pop 160ms ease-out;
  }
}

@keyframes try-pop {
  from {
    opacity: 0;
    translate: 0 -4px;
  }
}

.try .gloss .entry-term {
  font-size: 1.375rem;
}

.try .gloss-senses {
  margin: 8px 0 0;
  padding-left: 1.3em;
}

.try .gloss-senses li + li {
  margin-top: 2px;
}

.try .gloss-meaning {
  margin-top: 8px;
}

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

.try .gloss-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.try .gloss-actions .button.pressed {
  scale: 0.96;
}

/* 実演の指(丸い印)。押すと波紋が広がる */
.try .demo-finger {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: rgb(0 106 166 / 0.2);
  box-shadow: 0 0 0 2px var(--blue), 0 4px 10px rgb(23 36 45 / 0.25);
  pointer-events: none;
  opacity: 0;
}

.try .demo-finger.on {
  opacity: 1;
}

.try .demo-finger::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  opacity: 0;
}

.try .demo-finger.tap {
  animation: try-press 260ms ease-out;
}

.try .demo-finger.tap::after {
  animation: try-ripple 480ms ease-out;
}

/* 動きを減らす設定: 動かさず、最初に押す語に印を置くだけ */
.try .demo-finger.still {
  margin-top: 4px;
}

@keyframes try-press {
  50% {
    scale: 0.8;
  }
}

@keyframes try-ripple {
  from {
    opacity: 0.7;
    scale: 1;
  }
  to {
    opacity: 0;
    scale: 2.4;
  }
}

/* 拾った語が単語帳へ入る */
.fly-chip {
  position: fixed;
  z-index: 50;
  padding: 0 6px;
  border-radius: 4px;
  background: #ffd33d;
  color: #17242d;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- 単語帳 ---------- */

.try .lexicon h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}

.try .lexicon h2 .icon {
  color: var(--blue);
}

.try .count {
  font-family: var(--sans-ja);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.try .lexicon-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.try .lexicon-empty[hidden] {
  display: none;
}

/* 白紙の単語カード(罫線だけ) */
.try .empty-figure {
  flex: none;
  display: grid;
  align-content: center;
  gap: 7px;
  width: 64px;
  height: 46px;
  padding: 0 10px;
  border: 1px dashed #9fb3c1;
  border-radius: 6px;
}

.try .empty-line {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--rule);
}

.try .empty-line.short {
  width: 60%;
  background: var(--marker);
}

.try .captures {
  margin: 0;
  padding: 0;
  list-style: none;
}

.try .lex-item {
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--rule);
}

.try .lex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -8px;
}

.try .lex-item .entry-term {
  font-size: 1.375rem;
}

.try .lex-item .entry-meaning {
  margin-top: 2px;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.try .lex-item .entry-source {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
  font-size: 0.9375rem;
}

@media (prefers-reduced-motion: no-preference) {
  .try .lex-item.arrived {
    animation: try-arrive 1400ms ease-out;
  }
}

@keyframes try-arrive {
  from {
    background-color: var(--marker-soft);
  }
  to {
    background-color: transparent;
  }
}

.try .cta {
  margin-top: 16px;
  padding: 20px;
  border-radius: 12px;
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.try .cta[hidden] {
  display: none;
}

.try .cta-title {
  word-break: auto-phrase;
  text-wrap: balance;
  font-family: var(--sans-ja);
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 1.5;
  margin-bottom: 6px;
}

.try .cta p:not(.cta-title) {
  font-size: 0.9375rem;
  line-height: 1.75;
}

.try .cta .button {
  margin-top: 14px;
  width: 100%;
}

.try .cta .note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* 3 語目で単語帳の上に現れる(motion.md: medium 300ms / enter) */
@media (prefers-reduced-motion: no-preference) {
  .try .cta:not([hidden]) {
    animation: try-pop 300ms cubic-bezier(0.05, 0.7, 0.1, 1);
  }
}

/* 狭い画面: 単語帳は英文の下にあるので、下に件数のバーを出す。3 語からは登録の案内も並べ、横いっぱいに広げる */
.try .lexicon-bar {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
  box-shadow: 0 6px 16px -4px rgb(23 36 45 / 0.35);
}

.try .lexicon-bar.with-cta {
  left: 16px;
  padding: 6px 6px 6px 18px;
}

.try .bar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #ffffff;
  text-decoration: none;
}

.try .bar-link:hover {
  color: #ffffff;
}

.try .lexicon-bar .bar-cta {
  min-height: 44px;
  background: #ffd33d;
  color: #17242d;
}

.try .lexicon-bar .bar-cta:hover {
  background: #f2c522;
  color: #17242d;
}

.try .lexicon-bar .bar-cta[hidden] {
  display: none;
}

.try .lexicon-bar .count {
  color: #cfdbe3;
}

.try .lexicon-bar[hidden] {
  display: none;
}

@media (min-width: 960px) {
  .try .lexicon-bar {
    display: none;
  }
}

.try .lexicon {
  scroll-margin-top: 16px;
}

.try .nw {
  white-space: nowrap;
}

/* この文脈での意味(見本)を主に、一般的な訳は小さく */
.try .gloss-label {
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.try .gloss-label.general {
  margin-top: 8px;
  font-weight: 400;
}

.try .gloss-note {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.6;
}

.try .gloss-general {
  margin-top: 8px;
}

.try .gloss-senses.small {
  margin-top: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.try .gloss-senses:not(.small) {
  margin-top: 2px;
}

.try .gloss-hint {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.try .lex-item .entry-general {
  margin-top: 2px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}
