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

:root {
  --bg-top: #f8f4e8;
  --bg-bottom: #d8ecef;
  --panel: rgba(255, 255, 255, 0.86);
  --ink: #21242a;
  --muted: #596172;
  --line: #d2d8e2;
  --accent: #cc4125;
  --accent-soft: #ffe7da;
  --ok: #0d8a5f;
  --ok-soft: #e7fff2;
  --ng: #c62828;
  --ng-soft: #ffe8e8;
  --m-color: #202838;
  --p-color: #0f5da6;
  --s-color: #178847;
  --z-color: #6a2ca7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Zen Kaku Gothic New", "Yu Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 20% 10%,
      rgba(255, 186, 120, 0.36),
      transparent 45%
    ),
    radial-gradient(
      circle at 88% 12%,
      rgba(95, 201, 228, 0.32),
      transparent 42%
    ),
    linear-gradient(170deg, var(--bg-top), var(--bg-bottom));
}

.app {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 22px 14px 40px;
}

.hero {
  background: linear-gradient(
    130deg,
    rgba(255, 255, 255, 0.88),
    rgba(255, 248, 236, 0.9)
  );
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 14px 30px rgba(26, 42, 60, 0.13);
}

.hero-rule {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.hero-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.app-version {
  margin-bottom: 8px;
  color: #6f7a8e;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(1.7rem, 3.8vw, 2.35rem);
  line-height: 1.1;
}

.hero-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.hero-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #c4d3e8;
  background: linear-gradient(145deg, #f9fcff, #edf4ff);
  color: #1f3552;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.mode-link:hover {
  filter: brightness(1.03);
}

.panel {
  margin-top: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(24, 42, 62, 0.13);
  backdrop-filter: blur(4px);
}

.question-panel {
  padding: 18px;
}

.question-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-number {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  color: #833426;
}

.question-caption {
  color: var(--muted);
  font-size: 0.9rem;
}

.question-mode-block {
  margin-top: 10px;
}

.question-mode-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.question-mode-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.mode-help {
  position: relative;
}

.mode-help-toggle {
  list-style: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #8eb2d8;
  background: linear-gradient(145deg, #eef6ff, #dfeeff);
  color: #1d5f9f;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.mode-help-toggle::-webkit-details-marker {
  display: none;
}

.mode-help-content {
  position: absolute;
  top: 28px;
  left: 0;
  z-index: 5;
  width: 320px;
  border: 1px solid #bcd0e8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 20px rgba(23, 45, 72, 0.12);
  padding: 8px 10px;
}

.mode-help-content p {
  margin: 0;
  color: #2a3d57;
  font-size: 0.8rem;
  line-height: 1.5;
}

.mode-help-content p + p {
  margin-top: 4px;
}

.question-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-mode-button {
  border: 1px solid #b8c6da;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  background: linear-gradient(145deg, #fff, #f5f9ff);
  color: #29415f;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.question-mode-button:hover {
  filter: brightness(1.04);
}

.question-mode-button.active {
  border-color: #f0a57e;
  background: linear-gradient(145deg, #ffe3d2, #fff0e6);
  color: #9b391e;
}

.question-mode-button.locked {
  opacity: 0.55;
}

.account-block {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 9px 10px;
}

.account-status {
  margin: 0;
  font-weight: 700;
  color: #2a3c56;
}

.account-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-button {
  border: 1px solid #b8c6da;
  border-radius: 10px;
  min-height: 34px;
  padding: 0 10px;
  background: linear-gradient(145deg, #fff, #f5f9ff);
  color: #29415f;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.account-button:hover {
  filter: brightness(1.04);
}

.account-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.account-note.error {
  color: var(--ng);
  font-weight: 700;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  padding: 9px 10px;
}

.meta-item-wide {
  grid-column: span 2;
}

.indicator-pair {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.indicator-pair-single {
  gap: 0;
}

.indicator-item {
  flex: 1 1 0;
  min-width: 0;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 5px;
}

.meta-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #8eb2d8;
  background: linear-gradient(145deg, #eef6ff, #dfeeff);
  color: #1f3552;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.meta-value + .meta-value {
  margin-left: 8px;
}

.reach-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hand-block h2,
.choice-block h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.hand-block {
  margin-top: 14px;
}

.question-hand-grid {
  display: grid;
  gap: 10px;
}

.question-hand-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 9px 10px;
}

.question-hand-inline-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 9px 10px;
}

.question-hand-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.open-meld-inline-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.inline-open-meld {
  flex-wrap: nowrap;
}

.hand-groups {
  display: grid;
  gap: 9px;
}

.meld {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 66px;
}

/* .meld-has-kakan {
  align-items: flex-start;
  min-height: 50px;
} */

.meld.open {
  background: rgba(255, 255, 255, 0.82);
}

.meld-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #efb48f;
  background: var(--accent-soft);
  color: #8f3a1f;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.meld-call-ankan {
  border-color: #8eb2d8;
  background: linear-gradient(145deg, #eef6ff, #dfeeff);
  color: #1d5f9f;
}

.meld-caption {
  margin-left: auto;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.empty-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.tile-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
}

.tile-row-tight {
  gap: 0;
}

.tile-row-kakan {
  padding-top: 25px;
}

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 56px;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.tile-sideways {
  width: 56px;
  height: 40px;
}

.tile-sideways img {
  width: 40px;
  height: 56px;
  transform: rotate(90deg);
  transform-origin: center;
}

.tile-kakan-base {
  position: relative;
  overflow: visible;
}

.tile-kakan-top {
  position: absolute;
  left: 0;
  bottom: 100%;
  pointer-events: none;
  z-index: 2;
}

.winning-block {
  margin-top: 10px;
  border: 1px dashed #c4cedc;
  border-radius: 12px;
  background: rgba(252, 253, 255, 0.82);
  padding: 9px 10px;
}

.winning-line {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.win-extra-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.win-extra-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #8eb2d8;
  background: linear-gradient(145deg, #eef6ff, #dfeeff);
  color: #1d5f9f;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.win-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #f0a57e;
  background: linear-gradient(145deg, #ffe4d4, #fff1e7);
  color: #9b391e;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.choice-block {
  margin-top: 14px;
}

.debug-block {
  margin-top: 14px;
  border: 1px dashed #b9c8de;
  border-radius: 12px;
  padding: 10px;
  background: rgba(247, 251, 255, 0.72);
}

.debug-block h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.debug-buttons {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.debug-button {
  border: 1px solid #a5b8d4;
  border-radius: 10px;
  min-height: 40px;
  background: linear-gradient(145deg, #f8fbff, #edf4ff);
  color: #20344f;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  padding: 6px 8px;
}

.debug-button:hover {
  filter: brightness(1.03);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-button {
  border: 1px solid #bfcde0;
  border-radius: 13px;
  min-height: 48px;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #233148;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(30, 56, 90, 0.16);
}

.choice-button:disabled {
  cursor: default;
}

.choice-button.correct {
  border-color: #18a56a;
  background: linear-gradient(145deg, #f2fff8, #e6fff2);
  color: #0a804f;
}

.choice-button.wrong {
  border-color: #e43f3f;
  background: linear-gradient(145deg, #fff5f5, #ffe8e8);
  color: #a01e1e;
}

.result-panel {
  padding: 18px;
}

.hidden {
  display: none;
}

.result-message {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
}

.result-message.ok {
  color: var(--ok);
}

.result-message.ng {
  color: var(--ng);
}

.correct-answer {
  margin: 8px 0 0;
  color: #2b3a52;
  font-weight: 700;
}

.result-grid {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.reach-result-grid {
  grid-template-columns: minmax(330px, 1.35fr) minmax(210px, 0.9fr) minmax(
      250px,
      1fr
    );
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  padding: 10px;
}

.result-card h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
}

.yaku-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.result-card-yaku .line-item-label,
.result-card-yaku .line-item-sub-label,
.result-card-yaku .line-item-value {
  font-weight: 400;
}

.mcr-yaku-card .line-item-value {
  font-weight: 400;
}

.total-han-summary {
  margin: 10px 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px dashed #d4dceb;
  padding-top: 8px;
  color: #233148;
  font-size: 0.95rem;
  font-weight: 700;
}

.breakdown-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed #d4dceb;
  padding-bottom: 4px;
}

.line-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.line-item-label {
  color: #233148;
  text-align: left;
}

.line-item-label-wrap {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.line-item-sub-label {
  color: #8f9aad;
  font-size: 0.74rem;
  font-weight: 500;
}

.line-item-value {
  color: #233148;
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.breakdown-list .line-item-value {
  font-weight: 400;
}

.breakdown-list .line-item-label,
.breakdown-list .line-item-sub-label {
  font-weight: 400;
}

.score-dl {
  margin: 0;
  display: grid;
  gap: 6px;
}

.score-dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed #d4dceb;
  padding-bottom: 5px;
}

.score-dl div.hidden {
  display: none;
}

.score-dl div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.score-dl dt {
  color: var(--muted);
}

.score-dl dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.fu-raw-cell {
  font-weight: 400;
}

#fuRawRow dd {
  font-weight: 400;
}

.fu-raw-value {
  font-weight: 400;
}

.score-dl-breakdown {
  white-space: normal;
  text-align: left;
}

.score-dl .muted-fu dt,
.score-dl .muted-fu dd,
.score-dl .muted-fu .line-item-label,
.score-dl .muted-fu .line-item-value {
  color: #9aa3b3;
}

.mcr-total-summary {
  margin: 10px 0 0;
  font-size: 1.04rem;
  font-weight: 800;
  color: #22344d;
  text-align: right;
}

.next-button {
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  min-height: 46px;
  width: 100%;
  background: linear-gradient(140deg, #203a55, #2f5c86);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.next-button:hover {
  filter: brightness(1.07);
}

.changelog-panel {
  margin-top: 12px;
}

.changelog-details {
  border: 1px solid rgba(190, 205, 224, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
  padding: 8px 10px;
}

.changelog-details summary {
  cursor: pointer;
  color: #2a405f;
  font-size: 0.86rem;
  font-weight: 700;
}

.changelog-list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: #3a4c64;
  font-size: 0.83rem;
}

.site-footer {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.8);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #c4d3e8;
  background: linear-gradient(145deg, #f9fcff, #edf4ff);
  color: #1f3552;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.legal-link:hover {
  filter: brightness(1.03);
}

.copyright-text {
  margin: 10px 0 0;
  color: #728097;
  font-size: 0.77rem;
  text-align: left;
}

.legal-page-main {
  max-width: 980px;
}

.legal-card {
  padding: 16px;
}

.legal-dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.legal-dl div {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 12px;
  border-bottom: 1px dashed #d4dceb;
  padding-bottom: 8px;
}

.legal-dl div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legal-dl dt {
  color: var(--muted);
  font-weight: 700;
}

.legal-dl dd {
  margin: 0;
}

.legal-article {
  border-bottom: 1px dashed #d4dceb;
  padding: 10px 0;
}

.legal-article:first-child {
  padding-top: 0;
}

.legal-article:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legal-article h2 {
  /* margin: 0 0 10px; */
  font-size: 1.3rem;
}

.legal-article h3 {
  /* margin: 0 0 10px; */
  font-size: 1.1rem;
}

.legal-article p {
  margin: 0;
  line-height: 1.7;
}

.legal-article p + p {
  margin-top: 8px;
}

.legal-article ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.contact-card {
  padding: 16px;
}

.contact-form {
  margin: 0;
  display: grid;
  gap: 10px;
}

.contact-field {
  display: grid;
  gap: 5px;
}

.contact-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.contact-input {
  width: 100%;
  border: 1px solid #c3cfdf;
  border-radius: 10px;
  min-height: 38px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #24344e;
  font-family: inherit;
  font-size: 0.9rem;
}

.contact-textarea {
  min-height: 180px;
  resize: vertical;
}

.contact-honeypot {
  position: absolute;
  left: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-submit {
  border: none;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 12px;
  background: linear-gradient(140deg, #203a55, #2f5c86);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.contact-submit:hover {
  filter: brightness(1.06);
}

.contact-submit:disabled {
  opacity: 0.66;
  cursor: default;
}

.contact-status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.contact-status.ok {
  color: var(--ok);
  font-weight: 700;
}

.contact-status.ng {
  color: var(--ng);
  font-weight: 700;
}

.legal-tile-example {
  display: inline-flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 2px;
  vertical-align: middle;
  white-space: nowrap;
}

.legal-tile-row {
  display: inline-flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.legal-tile-row .tile,
.legal-tile-single {
  width: 28px;
  height: 40px;
  flex: 0 0 auto;
}

.mcr-rule-tile-win {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

@media (max-width: 820px) {
  .reach-result-grid {
    grid-template-columns: 1fr;
  }

  .meta-item-wide {
    grid-column: span 1;
  }

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

  .legal-dl div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
