.lang-corner.is-hidden,
.lang-corner[hidden] {
  display: none !important;
}

@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,600;0,700;1,600&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap");

.rules-btn {
  position: fixed;
  top: calc(3.35rem + env(safe-area-inset-top, 0px));
  left: 0.75rem;
  right: auto;
  bottom: auto;
  z-index: 12;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.95rem;
  border-radius: 4px 10px 4px 10px;
  border: 1px solid rgba(92, 58, 28, 0.45);
  background:
    linear-gradient(145deg, #f0e2c4 0%, #e4d0a8 45%, #d8c094 100%);
  color: #3a2412;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
.rules-btn:hover {
  filter: brightness(1.04);
}
/* oyundayken kurallar HUD ile çakışmasın */
body.is-playing .rules-btn {
  display: none !important;
}
html[dir="rtl"] .rules-btn {
  left: auto;
  right: 0.75rem;
}
html[dir="rtl"] body.is-playing .rules-btn {
  display: none !important;
}
@media (max-width: 700px) {
  html[dir="rtl"] .rules-btn {
    right: 0.5rem;
    left: auto;
  }
  .rules-btn {
    top: calc(3.1rem + env(safe-area-inset-top, 0px));
    left: 0.5rem;
    padding: 0.42rem 0.7rem;
    font-size: 0.88rem;
  }
}
.rules-btn-icon {
  width: 0.85rem;
  height: 1.1rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(92, 58, 28, 0.12), transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.rules-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(80, 50, 20, 0.35), transparent 50%),
    rgba(8, 10, 14, 0.72);
  padding: 1rem;
  overflow: auto;
}

.rules-modal.hidden { display: none !important; }

.rules-parchment {
  --ink-0: #8b2e2e;
  --ink-1: #1f5c45;
  --ink-2: #2a4578;
  --ink-3: #8a5a14;
  --ink-4: #6b3a6e;
  --ink-5: #1f6a6a;
  position: relative;
  width: min(540px, calc(100vw - 1.5rem));
  max-height: min(86vh, 740px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  color: #2c1c10;
  background:
    radial-gradient(ellipse at 12% 8%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(ellipse at 88% 92%, rgba(120, 70, 30, 0.12), transparent 45%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(90, 55, 25, 0.03) 28px,
      rgba(90, 55, 25, 0.03) 29px
    ),
    linear-gradient(160deg, #f7ecd2 0%, #edd9b0 42%, #e2c89a 78%, #d8bc8c 100%);
  border: 1px solid rgba(92, 58, 28, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 245, 220, 0.35) inset,
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(255, 255, 255, 0.2) inset;
}

.rules-parchment::before,
.rules-parchment::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
  opacity: 0.55;
  z-index: 1;
  background: repeating-linear-gradient(
    90deg,
    #5c3a1c 0 6px,
    #3d2612 6px 10px,
    #6a4524 10px 16px
  );
}
.rules-parchment::before { top: 0; border-radius: 8px 8px 0 0; }
.rules-parchment::after { bottom: 0; border-radius: 0 0 8px 8px; }

.rules-parchment-inner {
  position: relative;
  z-index: 2;
  padding: 1.55rem 1.35rem 1.35rem;
}

.rules-head {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(92, 58, 28, 0.22);
}

.rules-seal {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.55rem;
  border-radius: 50%;
  border: 2px solid rgba(139, 46, 46, 0.55);
  color: #8b2e2e;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  background: radial-gradient(circle at 35% 30%, #fff6e4, #e8d2a8);
  box-shadow: 0 2px 0 rgba(92, 58, 28, 0.15);
}

.rules-head h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.55rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #3a2412;
}

.rules-lead {
  margin: 0.45rem auto 0;
  max-width: 34ch;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #6a4e32;
  font-style: italic;
}

.rules-scroll-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.rules-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.55rem 0.35rem 0.55rem 0.15rem;
  border-bottom: 1px dashed rgba(92, 58, 28, 0.18);
}
.rules-item:last-child { border-bottom: none; }

.rules-num {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  min-width: 1.6rem;
  padding-top: 0.1rem;
  color: var(--tone);
  opacity: 0.9;
}

.rules-item-title {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--tone);
  margin-bottom: 0.2rem;
}

.rules-item-detail {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #4a3420;
}

.rules-item.tone-0 { --tone: var(--ink-0); }
.rules-item.tone-1 { --tone: var(--ink-1); }
.rules-item.tone-2 { --tone: var(--ink-2); }
.rules-item.tone-3 { --tone: var(--ink-3); }
.rules-item.tone-4 { --tone: var(--ink-4); }
.rules-item.tone-5 { --tone: var(--ink-5); }

.rules-foot {
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(92, 58, 28, 0.18);
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #6a4e32;
}

.rules-close {
  position: absolute;
  top: 1.15rem;
  right: 0.65rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(92, 58, 28, 0.35);
  border-radius: 50%;
  background: rgba(247, 236, 210, 0.92);
  color: #5c3a1c;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.rules-close:hover {
  background: #fff6e4;
}

@media (max-width: 700px) {
  .rules-modal {
    padding: 0.45rem;
    align-items: end;
    place-items: end center;
  }
  .rules-parchment {
    width: 100%;
    max-height: min(78vh, 640px);
    border-radius: 16px 16px 10px 10px;
  }
  .rules-parchment-inner {
    padding: 1.25rem 1rem 1.1rem;
  }
  .rules-head h3 {
    font-size: 1.35rem;
    padding-inline: 1.5rem;
  }
  .rules-lead { font-size: 0.86rem; }
  .rules-item-title { font-size: 1.05rem; }
  .rules-item-detail { font-size: 0.86rem; line-height: 1.4; }
  .rules-close { top: 0.75rem; right: 0.55rem; }
}

/* eski sınıf uyumu */
.rules-card { display: contents; }
.rules-list { display: contents; }

/* oyun sonu: form kesilmesin */
#end-panel.menu,
#end-panel.panel.menu {
  place-content: start center;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1rem 2.5rem;
  -webkit-overflow-scrolling: touch;
}
#end-panel #fb-root {
  width: min(440px, 94vw);
  margin: 0 auto;
}
#end-panel #back-menu-btn {
  margin: 0.75rem auto 1.25rem;
  display: block;
}

.overlay .panel,
.panel.overlay {
  max-width: min(28rem, 96vw) !important;
  max-height: min(92vh, 920px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.fb-box,
.fb-parchment {
  width: min(420px, 92vw);
  max-width: 100%;
  margin: 0.65rem auto 0;
  text-align: left;
  position: relative;
  padding: 1.25rem 1.2rem 1.15rem;
  box-sizing: border-box;
  border-radius: 6px;
  color: #2c1c10;
  background:
    radial-gradient(ellipse at 12% 8%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(ellipse at 88% 92%, rgba(120, 70, 30, 0.12), transparent 45%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(90, 55, 25, 0.03) 28px,
      rgba(90, 55, 25, 0.03) 29px
    ),
    linear-gradient(160deg, #f7ecd2 0%, #edd9b0 42%, #e2c89a 78%, #d8bc8c 100%);
  border: 1px solid rgba(92, 58, 28, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 245, 220, 0.35) inset,
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.fb-parchment::before,
.fb-parchment::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  pointer-events: none;
  opacity: 0.5;
  background: repeating-linear-gradient(
    90deg,
    #5c3a1c 0 6px,
    #3d2612 6px 10px,
    #6a4524 10px 16px
  );
}
.fb-parchment::before { top: 0; border-radius: 6px 6px 0 0; }
.fb-parchment::after { bottom: 0; border-radius: 0 0 6px 6px; }

.fb-seal {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  margin: 0.15rem auto 0.55rem;
  border-radius: 50%;
  border: 2px solid rgba(139, 46, 46, 0.55);
  color: #8b2e2e;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  background: radial-gradient(circle at 35% 30%, #fff6e4, #e8d2a8);
}

.fb-title {
  margin: 0 0 0.35rem;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8b2e2e;
}

.fb-lead {
  margin: 0 0 0.85rem;
  text-align: center;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #6a4e32;
  font-style: italic;
}

.fb-form {
  display: grid;
  gap: 0.55rem;
}

.fb-form label {
  display: grid;
  gap: 0.25rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.78rem;
  color: #5c3a1c;
}

.fb-form label > span {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #3a2412;
}

.fb-form input,
.fb-form textarea,
.fb-form select {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  border: 1px solid rgba(92, 58, 28, 0.35);
  background: rgba(255, 248, 230, 0.72);
  color: #2c1c10;
  outline: none;
}
.fb-form input:focus,
.fb-form textarea:focus,
.fb-form select:focus {
  border-color: rgba(139, 46, 46, 0.55);
  box-shadow: 0 0 0 2px rgba(139, 46, 46, 0.12);
}

.fb-check {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  grid-template-columns: none;
  font-size: 0.88rem !important;
  color: #4a3420 !important;
}

.fb-form button {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  padding: 0.7rem;
  border: 1px solid rgba(92, 58, 28, 0.4);
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(145deg, #c45c3a, #8b2e2e);
  color: #fff6e4;
  box-shadow: 0 4px 0 rgba(61, 24, 12, 0.35);
}
.fb-form button:hover:not(:disabled) {
  filter: brightness(1.05);
}
.fb-form button:disabled {
  opacity: 0.65;
  cursor: default;
}

.fb-status {
  min-height: 1.2em;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.9rem;
  color: #1f5c45;
  text-align: center;
}

.fb-pass.hidden { display: none !important; }

.fb-legal {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(92, 58, 28, 0.28);
}

.fb-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  justify-content: center;
  margin: 0 0 0.25rem;
}

.fb-legal-link {
  border: none;
  background: none;
  padding: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #8b2e2e;
  text-decoration: underline;
  cursor: pointer;
}

.fb-legal-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 16, 22, 0.55);
}

.fb-legal-modal.hidden { display: none !important; }

.fb-legal-card {
  width: min(420px, 94vw);
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 6px;
  background: linear-gradient(160deg, #f7ecd2, #e2c89a);
  border: 1px solid rgba(92, 58, 28, 0.35);
  color: #2c1c10;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.fb-legal-title {
  margin: 0 0 0.55rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.25rem;
  color: #8b2e2e;
  text-align: center;
}

.fb-legal-body {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  margin-bottom: 0.85rem;
}

.fb-legal-close {
  display: block;
  width: 100%;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.55rem;
  border: 1px solid rgba(92, 58, 28, 0.4);
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(145deg, #c45c3a, #8b2e2e);
  color: #fff6e4;
}
