/* style.css */
body {
  background: #d4e3d3;
  margin: 0;
  font-family: sans-serif;
}

body.romaji-off .romaji {
  display: none;
}

body.romaji-off .kana-btn:hover {
  background: #66676b;
  transform: scale(1.05);
}

body:not(.romaji-off) .kana-btn:hover {
  transform: scale(1.05);
}

.app {
  display: flex;
  grid-template-columns: minmax(180px, 240px) 1fr;
  min-height: 100vh;
}

.menu {
  /*#676b66color opcional más adelante */
  background: #676966;

  color: #d8e3d7;
  padding: 1rem;

  display: flex;
  flex-direction: column;
  gap: 1rem;

  position: sticky;
  top: 0;
  height: 100vh;
}

.menu-header {
  text-align: center;
  margin-bottom: 20px;
}

.menu-header h4 {
  margin: 0;
  font-size: 1.2rem;
  word-break: break-all;
}

.menu-nav {
  color: #ddd7e3;
}

.menu-footer {
  margin-top: auto;
  padding-top: 15px;
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.75;
}

.menu-text-link {
  cursor: pointer;
  text-decoration: underline;
}

.menu-text-link:hover {
  color: #fff;
  opacity: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.logo {
  width: 80px;
  margin-bottom: 10px;
}

.auth-link {
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

/* ===== PÁGINA DE INICIO ===== */
.home-container {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
  animation: fadeIn 1s ease-out;
}

.home-container h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  color: #686a65;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.home-subtitle {
  font-size: 1.3rem;
  font-weight: bold;
  color: #27425f;
  margin: 2rem 0;
  line-height: 1.6;
}

.home-text {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #2a2c29;
  margin: 2rem 0;
}

.btn-large {
  margin-top: 3rem;
  padding: 16px 40px;
  font-size: 1.3rem;
  /* no convencido de este color aun*/
  background: #2f6f4e;
  /* Verde profundo */
  color: #d7e3d7;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.3s;
}

.btn-large:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  background: #3f8a64;
  /* Variante más clara */
}

/* Controles de Kana */
.kana-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0 15px;
  padding: 5px 0;
  /* Fondo suave para destacar */
  position: sticky;
  top: 0;
  z-index: 5;
  /* Por encima de la grilla 
  border-bottom: 2px solid #72a37e;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 0 0 12px 12px; */
}

.kana-toggle {
  padding: 5px 9px;
  font-size: 1.1rem;
  background: #708276;
  color: #d7e3d7;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 90px;
  text-align: center;
}

.kana-toggle.active {
  background: #35521c;
  color: white;
  border-color: #72a37e;
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(114, 163, 126, 0.4);
}

.kana-toggle:hover {
  border-color: #72a37e;
  transform: scale(1.05);
}

/* Botón Romaji separado pero integrado */
.romaji-toggle {
  padding: 5px 9px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}


.romaji-toggle:hover {
  border-color: #72a37e;
  transform: scale(1.03);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu button {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px;
  cursor: pointer;
  background: #d7e3d7;
}

.content {
  background-image:
    linear-gradient(rgba(216, 227, 215, 0.92),
      rgba(216, 227, 215, 0.92)),
    url("../img/005.jpg");
  padding: 1.5rem;

  flex: 1;
  overflow-y: fixed;

  background-size: auto 500px;
  background-repeat: no-repeat;
  background-position: right bottom;
  background-attachment: fixed;
}

.kana-container {
  display: flex;
  flex-direction: column;
}

.kana-btn {
  position: relative;
  font-size: 2rem;
  padding: 8px;
  cursor: pointer;
  border: none;
  background: #d8e3d700;
  border-radius: 8px;
  transition:
    transform 0.1s;
}

.kana-btn .romaji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: #2e4c6e;
  opacity: 0;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  transition: opacity 0.2s;
}

.kana-btn:hover .romaji {
  opacity: 1;
  background: #919990;
  transform: scale(1);
}

.kana-btn:active {
  background: #bbbbbb;
}

.kana-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 10px;
}

.row-label {
  width: 20px;
  font-weight: bold;
  text-align: right;
  margin-right: 15px;
  padding-top: 10px;
}

.row-grid {
  display: flex;
  gap: 5px;
  flex-direction: row;
  flex-wrap: nowrap;
  flex: 1;
}

/* -------KANA LAB------- */
/* KANA LAB */
.lab-intro {
  font-size: 1.2rem;
  text-align: center;
  color: #2e4c6e;
  margin: 20px 0 40px;
  line-height: 1.6;
}

.lab-section {
  background: rgba(255, 255, 255, 0.7);
  padding: 20px;
  margin: 30px 0;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.lab-section h2 {
  margin-top: 0;
  color: #676966;
  border-bottom: 2px solid #676966;
  padding-bottom: 8px;
}

.converter {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

#converter-input {
  flex: 1;
  padding: 12px;
  font-size: 1.2rem;
  border: 2px solid #ccc;
  border-radius: 8px;
}

.converter-output {
  min-height: 60px;
  padding: 15px;
  background: #f0f0f0;
  border-radius: 8px;
  font-size: 2rem;
  text-align: center;
  margin-top: 10px;
}

#puzzle-kana {
  font-size: 4rem;
  text-align: center;
  margin: 30px 0;
  min-height: 100px;
}

#puzzle-input {
  width: 100%;
  padding: 12px;
  font-size: 1.2rem;
  margin: 15px 0;
  border-radius: 8px;
  border: 2px solid #ccc;
}

#puzzle-feedback {
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  margin: 20px 0;
  min-height: 40px;
}

.feedback-wrong {
  color: #5c6f82;
  /* gris azulado */
}

.feedback-close {
  color: #b08900;
  /* ámbar */
}

.feedback-correct {
  color: #2f6f4e;
  /* verde éxito */
}

#puzzle-meaning {
  font-style: italic;
  color: #2e4c6e;
  text-align: center;
  margin-top: 10px;
}

#suggestion-word {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  font-size: 1rem;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid #264936;
  background: #f5f9f6;
}

#suggest-submit {
  margin-top: 10px;
}

button {
  background: transparent;
  color: #264936;
  border: 1px solid #264936;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

button:hover {
  background: #264936;
  color: #d7e3d7;
}

/*
button {
  padding: 3px 6px;
  /* buscando un mejor color para background 
  background: #5e8a68;
  color: #2e4c6e;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}


button:hover {
  background: #264936;
}
  */

.result-hira,
.result-kata,
.result-romaji {
  font-size: 1.5rem;
  margin-top: 10px;
  padding: 10px;
  background: #f0f0f0;
  border-radius: 8px;
  text-align: center;
}

.result-hira span,
.result-kata span,
.result-romaji span {
  font-size: 2rem;
  color: #333333;
}

.result-kata {
  margin-top: 20px;
}

/* ===== Kana Lab Tabs ===== */
.lab-panel {
  display: none;
}

.lab-panel.active {
  display: block;
}

/* -------KANJI INTRO------- */
.kanji-intro {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.kanji-intro.hidden {
  display: none;
}

.intro-box {
  background:
    linear-gradient(rgba(216, 227, 215, 0.92),
      rgba(216, 227, 215, 0.92));
  background-size: auto 500px;
  background-repeat: no-repeat;
  background-position: right bottom;
  padding: 24px;
  max-width: 400px;
  border-radius: 12px;
  text-align: center;
}

.intro-box ul {
  text-align: left;
}

.intro-box button {
  margin-top: 16px;
  padding: 10px 18px;
  font-size: 1rem;
}

/*--------KANJI-------*/
kanji-container {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
}

.kanji-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanji-item {
  font-size: 2rem;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  background: #d8e3d7;
}

.kanji-item:hover {
  background: #919990;
}


#detail-kanji {
  text-align: center;
  font-size: 96px;
  line-height: 1;
  margin: 10px 0 20px;
  font-weight: 600;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filters select,
.filters input {
  padding: 8px;
  font-size: 1rem;
}

.kanji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 80px);
  gap: 8px;
  justify-content: start;
}

.kanji-char {
  font-size: 2.5rem;
}

.kanji-meaning {
  font-size: 0.9rem;
  margin-top: 5px;
}

/* AUTH MODAL & FORMS */
.auth-content {
  max-width: 400px;
  text-align: center;
}

.auth-content input {
  display: block;
  width: 90%;
  margin: 10px auto;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #cccccc;
  border-radius: 5px;
}

.auth-content button {
  width: 90%;
  margin-top: 10px;
  padding: 10px;
  font-size: 1rem;

  color: rgb(0, 0, 0);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.auth-content button:hover {
  background-color: #676966;
  color: rgb(255, 255, 255);
}

.error-msg {
  color: #d9534f;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.link {
  color: #72a37e;
  cursor: pointer;
  text-decoration: underline;
}

/* HEADER AUTH LINKS */
.auth-links {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  font-size: 0.9rem;
  color: #d7e3d7;
}

.auth-link {
  cursor: pointer;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
  color: white;
}

/* FAVORITE BUTTON */
.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-favorite {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #ccc;
  transition: transform 0.2s, color 0.2s;
  padding: 0;
  line-height: 1;
}

.btn-favorite:hover {
  transform: scale(1.1);
}

.btn-favorite.active {
  color: #e74c3c;
  /* Red heart */
}

/* MNEMONICS SECTION */
.mnemo-section {
  margin-top: 20px;
  text-align: left;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

.mnemo-section h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: #555;
}

.mnemo-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mnemo-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #eee;
  padding: 5px;
  border-radius: 5px;
  margin-bottom: 10px;
}

.mnemo-card {
  background: #f9f9f9;
  border-bottom: 1px solid #eee;
  padding: 8px;
  margin-bottom: 5px;
  position: relative;
  word-wrap: break-word;
  /* Fix text overflow */
}

.mnemo-card .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mnemo-card .actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.mnemo-card .actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
}

.mnemo-card .actions button:hover {
  color: #000;
}

.mnemo-card .btn-adopt {
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 0.7rem;
  padding: 2px 5px;
}

.mnemo-card .btn-adopt.adopted {
  background: #72a37e;
  color: white;
  border-color: #72a37e;
}

.mnemo-form textarea {
  width: 100%;
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  box-sizing: border-box;
  /* padding inside width */
}

.mnemo-form button {
  margin-top: 5px;
  padding: 5px 15px;
  background-color: #72a37e;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#mnemo-login-msg a {
  color: #72a37e;
  cursor: pointer;
  text-decoration: underline;
}

.hidden {
  display: none;
}

.kanji-card {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: #d8e3d700;
  border-radius: 10px;
  cursor: pointer;

  transition: transform 0.1s, background 0.2s;
}

.kanji-card:hover {
  background: #919990;
  transform: scale(1.08);
}

.kanji-count {
  margin: 10px 0;
  font-size: 0.9rem;
  color: #333;
}

mark {
  background: #ffe08a;
  color: #000;
  border-radius: 4px;
  padding: 0 2px;
}

/*----- MODAL-----*/
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

/* Fondo oscuro */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

/* Tarjeta */
.modal-content {
  position: relative;
  max-width: 400px;
  margin: 10vh auto;

  max-height: 80vh;
  overflow-y: auto;

  background: #d7e3d7;
  background-image: linear-gradient(rgba(255, 255, 255, 0.85),
      rgba(255, 255, 255, 0.85)),
    url("../img/003.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  padding: 15px;
  border-radius: 12px;
  z-index: 1;
  animation: pop 0.15s ease-out;
}

/* Botón cerrar */
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 32px;
  height: 32px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  line-height: 1;

  background: transparent;
  border: none;
  cursor: pointer;
}

.auth-content .modal-close {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
}

.strokes-img {
  width: 100%;
  max-width: 200px;
  margin: 15px auto;
  display: block;
  border-radius: 8px;
}

@keyframes pop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/****** SVG *******/
svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}

svg path {
  fill: none;
  stroke: #000;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Trazo activo */
svg path.active-stroke {
  stroke: #df3f3f;
}

/* Trazo ya dibujado */
svg path.done-stroke {
  stroke: #000;
  opacity: 1;
}

/* Numeros de trazos */
svg text {
  font-size: 14px;
  fill: #d64545;
  display: none;
  pointer-events: none;
  font-weight: bold;
}

@keyframes draw-stroke {
  from {
    stroke-dashoffset: var(--dash);
  }

  to {
    stroke-dashoffset: 0;
  }
}

/* PROFILE VIEW */
.profile-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.profile-col {
  flex: 1;
  min-width: 250px;
  background: rgba(255, 255, 255, 0.5);
  padding: 15px;
  border-radius: 10px;
}

.profile-col h2 {
  font-size: 1.2rem;
  margin-top: 0;
  border-bottom: 2px solid #72a37e;
  padding-bottom: 5px;
  color: #444;
}

.profile-mnemo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.profile-mnemo-card {
  background: #fff;
  border-left: 4px solid #72a37e;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  /* Legacy */
  overflow-wrap: break-word;
  /* Modern */
  word-break: break-word;
  /* Ensure long words break */
}

.profile-mnemo-card .kanji-ref {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin-right: 10px;
}

.profile-mnemo-card p {
  margin: 5px 0;
  display: inline;
}

.profile-mnemo-card .meta {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 5px;
}

.profile-mnemo-card .actions button {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  padding: 2px 8px;
  margin-left: 5px;
}

.profile-mnemo-card .actions button:hover {
  background: #eee;
  color: #333;
}

.text-view {
  max-width: 720px;
  margin: 4rem auto;
  padding: 1.5rem;
  line-height: 1.6;
  color: #2e4c6e;
  font-size: 0.95rem;
}

.text-view h2 {
  margin-top: 2rem;
  color: #676966;
}

.text-view small {
  opacity: 0.7;
}

.btn-content {
  background: #264936;
  color: #d7e3d7;
  border: none;
}