:root {
  --bg-color: #f4f4f4;
  --text-color: #333;
  --header-bg: #333;
  --header-text: #fff;
  --panel-bg: #fff;
  --panel-text: #333;
  --button-bg: #4caf50;
  --button-text: #fff;
  --menu-button-bg: #ddd;
  --menu-button-text: #333;
  --popup-bg: #fff;
  --popup-text: #333;
  --border-color: #ccc;
  --box-bg: #e0e0e0;
  --box-text: #333;
}

.left-text {
  text-align: left;
  margin: 0 auto;
  line-height: 1.4;
}

body {
  font-family: 'Montserrat', sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
}

main {
  flex: 1;
  padding-bottom: 20px;
}

h1 {
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 70px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.title {
  color: white;
  font-size: 1.8rem;
  letter-spacing: 2px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0px;
}

.title-text {
  background: linear-gradient(135deg, #fff 0%, #e6e6e6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  margin: 0;
}

@media (max-width: 600px) {
  .title-text {
    margin: 0;
  }
}

.icon {
  position: static;
  transform: none;
  cursor: pointer;
  color: #ffffff;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  z-index: 10;
}

.icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.material-icons {
  font-size: 24px;
}

.header-left,
.header-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 12;
}

.header-left {
  left: 1.5rem;
}

.header-actions {
  right: 1.5rem;
}

.icon-right {
  right: auto;
}

.header-actions .icon,
.header-left .icon {
  position: static;
  transform: none;
}

.lab-toggle {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  min-height: 42px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.lab-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.lab-toggle.is-lab-open {
  background: #4caf50;
  border-color: #4caf50;
}

@media (max-width: 600px) {
  .header {
    height: 50px;
    padding: 0.75rem;
  }

  .title {
    font-size: 1.4rem;
    gap: 8px;
  }

  .material-icons {
    font-size: 22px;
  }

  .icon {
    width: 35px;
    height: 35px;
  }

  .header-left {
    left: 1rem;
    gap: 6px;
  }

  .header-actions {
    right: 1rem;
    gap: 6px;
  }

  .lab-toggle {
    font-size: 0.84rem;
    padding: 8px 14px;
    min-height: 38px;
  }
}

.footer {

  background: var(--button-bg);
  color: white;
  padding: 10px;
  text-align: center;
}

.footer .mapping-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.footer .mapping-footer div {
  background: white;
  color: var(--button-bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: bold;
}

/* Popups */
.popup {
  display: none;
  position: fixed;
  background: var(--popup-bg);
  color: var(--popup-text);
  border: 1px solid var(--border-color);
  padding: 20px;
  width: 800px;
  max-width: 90%;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  z-index: 1000;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  justify-content: center;
  align-items: center;
  max-height: 80%;
  overflow-y: auto;
}

h2,
h3 {
  margin-top: 15px;
  margin-bottom: 15px;
  color: var(--text-color);
}

p,
td {
  color: #666;
  line-height: 1.5;
  margin-top: 15px;
  margin-bottom: 15px;
}

small {
  margin: 4px 0 0 0;
  color: #777;
  line-height: 1.4;
}

.popup table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.popup th,
.popup td {
  padding: 8px;
  line-height: 1.2;
  text-align: center;
  border: 1px solid #ddd;
}

.popup th {
  background: var(--button-bg);
  color: white;
}

.popup ul {
  text-align: left;
  padding-left: 20px;
}

.popup li {
  margin-bottom: 8px;
  color: #444;
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 9;
}

.app-section {
  display: none;
}

.app-section.active {
  display: block;
  animation: section-reveal 0.25s ease;
}

@keyframes section-reveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Menu */
.menu {
  display: flex;
  width: 100%;
}

.menu button {
  flex: 1;
  padding: 20px;
  font-size: 1.5em;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
  background: var(--menu-button-bg);
  color: var(--menu-button-text);
}

.menu button.active {
  background: var(--button-bg);
  color: var(--button-text);
}

#game-container {
  padding: 30px;
  padding-left: 50px;
  padding-right: 50px;
  font-size: 1.2em;
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 10px;
  margin: 20px auto;
  max-width: 500px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  flex: 1;
}

#page-container {
  flex: 1;
}

#timer {
  top: 10px;
  background: var(--text-color);
  color: var(--bg-color);
  font-size: 1.5rem;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 5;
  margin: 10px auto;
  padding: 10px;
  border: 2px solid var(--text-color);
  border-radius: 5px;
  font-size: 1.2em;
  display: none;
}

#info-text {
  margin-top: 0;
}

#box {
  background: var(--box-bg);
  color: var(--box-text);

  margin: 10px auto;
  padding: 10px;
  border: 2px solid var(--text-color);
  border-radius: 5px;
  font-size: 1.2em;
  display: none;
}

#word-input,
#number-input {
  padding: 10px;
  font-size: 1.2em;
  border: 2px solid var(--text-color);
  border-radius: 5px;
  margin-top: 10px;
  display: none;
}

#word-input:focus,
#number-input:focus {
  outline: none;
  border-color: var(--button-bg);
  box-shadow: 0 0 5px var(--button-bg);
}

#start-button {
  margin-top: 15px;
  padding: 10px 20px;
  font-size: 1.2em;
  border: none;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 5px;
  cursor: pointer;
  display: inline-block;
}

.share-button {
  margin-top: 15px;
  padding: 10px 20px;
  font-size: 1.2em;
  border: none;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 5px;
  cursor: pointer;
}

.export-import-button {
  margin-top: 10px;
  margin-right: 5px;
  padding: 8px 16px;
  font-size: 1em;
  border: none;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 5px;
  cursor: pointer;
}

.export-import-button:hover {
  background: #43a047;
}

a {
  display: inline-block;
}

.donation-feedback-button {
  margin-top: 10px;
  margin-right: 5px;
  padding: 8px 16px;
  font-size: 1em;
  border: none;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 5px;
  cursor: pointer;
}

.donation-feedback-button:hover {
  background: #43a047;
}

.support-message {
  text-align: left;
  margin: 0 0 10px;
  line-height: 1.45;
}

.correct {
  animation: blink-green 0.5s ease-in-out;
}

.incorrect {
  animation: blink-red 0.5s ease-in-out;
}

@keyframes blink-green {

  0%,
  100% {
    background-color: inherit;
  }

  50% {
    background-color: lightgreen;
  }
}

@keyframes blink-red {

  0%,
  100% {
    background-color: inherit;
  }

  50% {
    background-color: lightcoral;
  }
}

html,
body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#resoconto {
  display: none;
  margin: 10px;
  padding: 10px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--button-bg);
}

input:checked+.slider:before {
  transform: translateX(22px);
}

#custom-alert {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--popup-bg);
  color: var(--popup-text);
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  font-size: 1.1em;
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 2rem 0;
  flex-wrap: wrap;
}

@media (max-width:600px) {
  .title-container {
    gap: 10px;
  }
}

.svg-container {
  width: 35px;
  height: 35px;
  display: flex;
  margin: 0;
  align-items: center;
}

@media (max-width:600px) {
  .svg-container {}
}

.svg-img {
  width: 100%;
  height: 100%;
}

.svg-container:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

#loading-message {
  display: none;
  margin-top: 10px;
  color: var(--text-color);
  background-color: #fff4c2;
  border: 1px solid #ffc107;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
}

#loading-message-first {
  display: none;
  margin-top: 10px;
  color: var(--text-color);
  background-color: #fff4c2;
  border: 1px solid #ffc107;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
}

.input-group {
  display: flex;
  justify-content: center;

  margin: 10px auto;
  gap: 10px;
  
}

.input-group input {
  width: 100%;
  font-size: 1.2em;
  border: 2px solid var(--text-color);
  border-radius: 5px;
  outline: none;
  box-sizing: border-box;

}

.submit-btn {
  margin-top: 10px;
  padding: 10px;
  font-size: 1.2em;
  border: 2px solid var(--text-color);
  border-radius: 5px;
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: 5px;
  cursor: pointer;
  display: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.submit-btn:hover {
  background: #43a047;
}

#lab-section {
  padding: 16px;
  overflow-x: hidden;
}

.lab-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
}

#lab-converter-container {
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 10px;
  margin: 12px auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 18px;
  width: 100%;
  box-sizing: border-box;
}

.lab-input-group {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: stretch;
  align-items: center;
  box-sizing: border-box;
}

#lab-unified-input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 56px;
  font-size: 1.15em;
  border: 2px solid var(--text-color);
  border-radius: 12px;
  padding: 0 16px;
  outline: none;
  box-sizing: border-box;
}

#lab-unified-input:focus {
  border-color: var(--button-bg);
  box-shadow: 0 0 5px var(--button-bg);
}

.lab-convert-btn {
  margin-top: 0;
  min-height: 56px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 600;
  display: inline-block;
}

#lab-mode-hint {
  margin: 12px 2px 2px 2px;
  color: #666;
  text-align: left;
}

#lab-result-container {
  width: 100%;
  min-height: 230px;
  margin: 14px auto;
  padding: 18px;
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  overflow-x: hidden;
}

.lab-result-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin: 0 0 10px 0;
  text-align: center;
}

.lab-result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 12px;
  margin-bottom: 10px;
}

.lab-result-view-toggle {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-self: end;
  align-self: start;
  background: #eef2f6;
  border: 1px solid #cdd7e1;
  border-radius: 999px;
  padding: 3px;
}

.lab-result-limit-note {
  margin: 0 0 10px 0;
  padding: 10px 12px;
  border: 1px solid #f2d39a;
  background: #fff7e9;
  color: #8c5b16;
  border-radius: 8px;
  text-align: left;
}

.lab-result-mode-btn {
  border: none;
  background: transparent;
  color: #405162;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
  cursor: pointer;
}

.lab-result-mode-btn.active {
  background: var(--button-bg);
  color: var(--button-text);
}

.lab-result-number-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.lab-result-big-number {
  color: var(--text-color);
  font-size: clamp(2.4rem, 9vw, 5.8rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.1;
  word-break: break-word;
}

.lab-conversion-warning {
  color: #b5521d;
  font-weight: 600;
  margin-top: 10px;
  text-align: center;
}

.lab-result-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lab-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.lab-result-table {
  width: 100%;
  border-collapse: collapse;
}

.lab-result-table th,
.lab-result-table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.lab-result-table th {
  text-align: center;
  background: #efefef;
  color: #333;
}

.lab-table-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.lab-table-page-btn {
  border: 1px solid #c4c4c4;
  background: #f7f7f7;
  color: #333;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}

.lab-table-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lab-table-page-info {
  color: #4f5f71;
  font-size: 0.92rem;
}

.lab-graph-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lab-graph-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lab-graph-control-btn {
  border: 1px solid #c4c4c4;
  background: #f7f7f7;
  color: #333;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}

.lab-graph-control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lab-graph-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  overflow-x: visible;
  padding-bottom: 4px;
  max-width: 100%;
  box-sizing: border-box;
}

.lab-graph-selected-track {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  flex-wrap: wrap;
  min-width: 0;
  width: 100%;
}

.lab-graph-selected-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lab-graph-step-line {
  width: 24px;
  border-top: 2px solid #8e9cad;
}

.lab-graph-selected-placeholder {
  color: #666;
  font-style: italic;
}

.lab-graph-bridge {
  display: none;
  width: 28px;
  border-top: 2px solid #8e9cad;
  margin-top: 30px;
  flex: 0 0 auto;
}

.lab-graph-branch {
  position: relative;
  padding-left: 24px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.lab-graph-branch::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  border-left: 2px dashed #9fabb9;
}

.lab-graph-candidate-row {
  position: relative;
  margin: 8px 0;
}

.lab-graph-candidate-row::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  width: 15px;
  border-top: 2px solid #9fabb9;
  transform: translateY(-50%);
}

.lab-graph-node {
  border: 2px solid #9cafc1;
  border-radius: 999px;
  background: #fff;
  color: #333;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: normal;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.lab-graph-node-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6e8092;
  flex: 0 0 auto;
}

.lab-graph-node-part {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4f5f71;
  border: 1px solid #c8d1db;
  border-radius: 999px;
  padding: 1px 7px;
}

.lab-graph-node-selected {
  border-color: var(--button-bg);
  background: #ebf7ef;
  cursor: pointer;
}

.lab-graph-node-selected .lab-graph-node-dot {
  background: var(--button-bg);
}

.lab-graph-node-selected:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.lab-graph-node-candidate {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.lab-graph-node-candidate:hover {
  border-color: var(--button-bg);
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.lab-graph-end {
  border: 1px dashed #b5c0cc;
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
  color: #666;
}

.lab-graph-complete {
  border: 1px solid #bfe0cb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #eff9f2;
  color: #2f6c43;
  font-weight: 600;
}

@media (max-width: 768px) {
  #lab-section {
    padding: 10px;
  }

  #lab-converter-container {
    padding: 12px;
  }

  .lab-input-group {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  #lab-unified-input {
    width: 100%;
  }

  .lab-convert-btn {
    width: 100%;
  }

  #lab-result-container {
    padding: 12px;
    min-height: 180px;
  }

  .lab-result-head {
    align-items: start;
  }

  .lab-table-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .lab-table-page-btn {
    width: 100%;
  }

  .lab-table-page-info {
    text-align: center;
  }

  .lab-graph-stage {
    flex-direction: column;
    gap: 10px;
  }

  .lab-graph-bridge {
    display: none;
  }

  .lab-graph-branch {
    min-width: 0;
    width: 100%;
  }
}

/* =========================================================
   Full-width Fluid Edge-to-edge redesign
   ========================================================= */

:root {
  --bg-color: #eef1f4;
  --bg-elevated: #ffffff;
  --bg-subtle: #f7f9fb;
  --text-color: #1f2b32;
  --text-muted: #54636f;
  --header-bg: #232a30;
  --header-text: #f8fbfd;
  --panel-bg: #ffffff;
  --panel-text: #1f2b32;
  --button-bg: #4caf50;
  --button-bg-hover: #3d9b42;
  --button-text: #ffffff;
  --menu-button-bg: #dce2e8;
  --menu-button-text: #34414a;
  --popup-bg: #ffffff;
  --popup-text: #1f2b32;
  --border-color: #c9d3dc;
  --box-bg: #f3f7fa;
  --box-text: #1f2b32;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px rgba(24, 34, 43, 0.08);
  --shadow-strong: 0 22px 44px rgba(24, 34, 43, 0.18);
}

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

html,
body {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  display: block;
  margin: 0;
  padding: 0;
  font-family: "Manrope", "Montserrat", sans-serif;
  color: var(--text-color);
  background:
    radial-gradient(1200px 700px at 96% -8%, rgba(76, 175, 80, 0.16), transparent 60%),
    radial-gradient(800px 460px at -4% 10%, rgba(31, 111, 54, 0.11), transparent 70%),
    var(--bg-color);
  text-align: left;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #84a998 #dce4eb;
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: #dce4eb;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(145deg, #8cb5a0 0%, #5a9071 100%);
  border-radius: 999px;
  border: 2px solid #dce4eb;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(145deg, #79a98f 0%, #477a5f 100%);
}

main {
  width: 100%;
  padding: clamp(12px, 1.8vw, 22px);
}

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  height: auto;
  min-height: 82px;
  padding: 12px clamp(12px, 2vw, 26px);
  background:
    linear-gradient(120deg, #1d242a 0%, #2a3238 55%, #1f6f36 190%);
  box-shadow: var(--shadow-strong);
}

.title-container {
  margin: 0;
  gap: clamp(8px, 1.1vw, 18px);
  min-width: 0;
  max-width: calc(100% - 156px);
}

.title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.2rem, 1.6vw + 0.8rem, 2rem);
  letter-spacing: 0.06em;
  font-weight: 700;
  min-width: 0;
}

.title-text {
  background: linear-gradient(125deg, #f6faf7 0%, #dff0e2 85%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svg-container {
  width: clamp(28px, 2vw, 38px);
  height: clamp(28px, 2vw, 38px);
}

.header-left,
.header-actions {
  gap: 10px;
}

.icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.icon:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
}

.lab-toggle {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 10px 20px;
}

.lab-toggle.is-lab-open {
  background: var(--button-bg);
  border-color: var(--button-bg);
}

.app-section {
  display: none;
}

.app-section.active {
  display: grid;
  width: 100%;
  gap: clamp(12px, 1.5vw, 22px);
}

#play-section.active {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "menu"
    "game"
    "score";
  align-items: stretch;
  min-height: 0;
}

.menu {
  grid-area: menu;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.menu button {
  border: none;
  border-radius: 12px;
  padding: clamp(14px, 1.4vw, 18px);
  background: transparent;
  color: var(--menu-button-text);
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1rem, 0.95rem + 0.45vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.menu button:hover {
  transform: translateY(-1px);
  background: #ecf1f5;
}

.menu button.active {
  background: linear-gradient(140deg, #4caf50 0%, #3f9c45 100%);
  color: #fff;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.2);
}

#page-container {
  grid-area: game;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#game-container {
  margin: 0;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: clamp(18px, 2vw, 32px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(130, 147, 161, 0.32);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.97) 0%, rgba(244, 248, 251, 0.92) 100%);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

#game-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(620px 220px at 95% -10%, rgba(76, 175, 80, 0.12), transparent 68%);
  pointer-events: none;
}

#timer {
  margin: 0;
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: #232a30;
  color: #f8fbfd;
  font-size: clamp(1rem, 1.4vw, 1.28rem);
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(35, 42, 48, 0.24);
}

#info-text {
  margin: 0;
  width: 100%;
  padding: clamp(18px, 2.2vw, 30px);
  border: 1px solid #d3dde6;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, #ffffff 0%, #eff5fb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  color: var(--text-muted);
  line-height: 1.55;
}

.mode-missions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 18px);
  width: min(1040px, 100%);
  margin: 0 auto;
}

.mode-mission-card {
  display: grid;
  gap: 12px;
  text-align: left;
  padding: clamp(16px, 1.9vw, 22px);
  border: 1px solid #cad5df;
  border-radius: 16px;
  background: linear-gradient(155deg, #ffffff 0%, #f1f6fb 100%);
  box-shadow: 0 8px 20px rgba(32, 46, 58, 0.09);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.mode-mission-card:hover {
  transform: translateY(-2px);
  border-color: #a2b7c9;
}

.mode-mission-card.is-active {
  border-color: #4caf50;
  box-shadow: 0 14px 28px rgba(76, 175, 80, 0.24);
  background: linear-gradient(155deg, #ffffff 0%, #edf8ef 100%);
}

.mode-mission-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 800;
  color: #4f6170;
}

.mode-mission-title {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.08rem, 1.1vw + 0.78rem, 1.52rem);
  line-height: 1.23;
  color: #1d2831;
}

.mode-mission-detail {
  margin: 0;
  font-size: clamp(0.95rem, 0.92rem + 0.2vw, 1.08rem);
  color: #4f6170;
}

.mode-mission-goal {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1f6f36;
}

.mode-mission-flow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #b8c8d7;
  background: #f2f7fc;
  color: #31414d;
  font-weight: 700;
  font-size: 0.86rem;
}

#game-container.is-mode-preview {
  justify-content: center;
}

#game-container.is-mode-preview #info-text {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

#game-container.is-mode-preview #start-button {
  align-self: center;
  min-width: 220px;
}

.support-message {
  margin: 0 0 14px;
  max-width: 72ch;
  line-height: 1.5;
}

.support-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.dictionary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.popup .support-actions a {
  display: block;
  width: 100%;
  margin: 0;
}

.popup .support-actions .donation-feedback-button {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.28;
}

#box {
  margin: 0;
  width: 100%;
  border: 1px solid #c9d5de;
  border-radius: var(--radius-md);
  padding: clamp(16px, 1.4vw, 22px);
  background: var(--box-bg);
  color: var(--box-text);
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.45rem, 1.8vw + 0.7rem, 2.15rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
}

#input-group {
  margin: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

#word-input,
#number-input,
#lab-unified-input {
  flex: 1 1 300px;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #bfcbd6;
  border-radius: 12px;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.15rem);
  color: var(--panel-text);
  background: #fff;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

#word-input:focus,
#number-input:focus,
#lab-unified-input:focus {
  outline: none;
  border-color: var(--button-bg);
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15);
}

#start-button,
.submit-btn,
.share-button,
.export-import-button,
.donation-feedback-button,
.lab-convert-btn {
  margin: 0;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(0.98rem, 0.92rem + 0.24vw, 1.12rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--button-text);
  background: linear-gradient(140deg, var(--button-bg) 0%, #418f45 100%);
  box-shadow: 0 10px 22px rgba(76, 175, 80, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

#start-button:hover,
.submit-btn:hover,
.share-button:hover,
.export-import-button:hover,
.donation-feedback-button:hover,
.lab-convert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(76, 175, 80, 0.3);
  background: linear-gradient(140deg, var(--button-bg-hover) 0%, #337e38 100%);
}

#start-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.submit-btn {
  white-space: nowrap;
}

#resoconto {
  grid-area: score;
  margin: 0;
  max-width: none;
  width: 100%;
  max-height: min(72vh, 760px);
  overflow: auto;
  padding: clamp(14px, 1.4vw, 20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(130, 147, 161, 0.32);
  background: linear-gradient(160deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: var(--shadow-soft);
}

#resoconto p {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px dashed #d4dee7;
  color: #2f3b45;
  line-height: 1.45;
}

#resoconto p:last-child {
  border-bottom: none;
}

#lab-section {
  width: 100%;
  padding: 0;
}

.lab-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(12px, 1.5vw, 20px);
}

#lab-converter-container,
#lab-result-container {
  width: 100%;
  margin: 0;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(130, 147, 161, 0.32);
  background: linear-gradient(160deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: var(--shadow-soft);
}

#lab-converter-container {
  padding: clamp(14px, 1.7vw, 24px);
}

#lab-result-container {
  min-height: 0;
  padding: clamp(16px, 1.7vw, 26px);
}

.lab-input-group {
  gap: 10px;
}

.lab-convert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 130px;
}

#lab-mode-hint,
.lab-result-title,
.lab-table-page-info,
.lab-graph-selected-placeholder,
.lab-graph-end,
.lab-result-limit-note {
  color: var(--text-muted);
}

.lab-result-view-toggle {
  background: #edf2f7;
  border: 1px solid #d2dde6;
}

.lab-result-mode-btn.active {
  background: var(--button-bg);
  color: #fff;
}

.lab-result-table th {
  background: #edf2f7;
  color: #2e3c48;
}

.lab-result-table th,
.lab-result-table td {
  border-color: #d4dee7;
}

.lab-table-page-btn,
.lab-graph-control-btn {
  border: 1px solid #c4d0da;
  background: #f4f8fb;
  color: #31414d;
}

.lab-graph-panel {
  display: grid;
  gap: 12px;
}

.lab-graph-hero {
  border: 1px solid #cfd9e3;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(150deg, #ffffff 0%, #edf4fa 100%);
}

.lab-graph-hero-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.lab-graph-hero-title {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  color: #243442;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lab-graph-hero-stats {
  font-weight: 700;
  color: #2f6c43;
}

.lab-graph-progress {
  margin-top: 8px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #d8e3ec;
  overflow: hidden;
}

.lab-graph-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(120deg, #4caf50 0%, #2f6c43 100%);
  transition: width 0.25s ease;
}

.lab-graph-hero-foot {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #54636f;
  font-size: 0.9rem;
}

.lab-graph-hero-foot span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lab-graph-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lab-graph-dict-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #ccd7e0;
  border-radius: 999px;
  background: #eef3f8;
}

.lab-graph-dict-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4f6070;
  padding: 0 6px 0 8px;
}

.lab-graph-dict-toggle .lab-result-mode-btn {
  padding: 6px 12px;
  min-height: 34px;
}

.lab-graph-control-btn {
  border-radius: 10px;
  font-weight: 700;
}

.lab-graph-stage {
  display: grid;
  gap: 10px;
}

.lab-graph-section-title {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5a6b79;
}

.lab-graph-selected-track {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  border: 1px dashed #c9d4df;
  border-radius: 12px;
  padding: 10px;
  background: #f7fafc;
}

.lab-graph-selected-step {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.lab-graph-step-line {
  width: 16px;
  border-top: 2px solid #9caebb;
}

.lab-graph-branch {
  position: static;
  padding-left: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.lab-graph-branch::before,
.lab-graph-candidate-row::before {
  content: none;
}

.lab-graph-candidate-row {
  margin: 0;
}

.lab-graph-node {
  width: auto;
  max-width: 100%;
  border: 1px solid #b8c6d3;
  border-radius: 999px;
  background: #fff;
  color: #31414d;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.lab-graph-node-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  background: #e8f0f7;
  color: #405162;
}

.lab-graph-node-word {
  min-width: 0;
  font-weight: 700;
  color: #253540;
  overflow-wrap: anywhere;
}

.lab-graph-node-part {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4f5f71;
  border: 1px solid #c8d1db;
  border-radius: 999px;
  padding: 2px 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lab-graph-node-meta {
  display: none;
}

.lab-graph-node-selected {
  border-color: var(--button-bg);
  background: #ecf8ef;
  cursor: pointer;
}

.lab-graph-node-selected .lab-graph-node-index {
  background: rgba(76, 175, 80, 0.2);
  color: #2f6c43;
}

.lab-graph-node-candidate {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.lab-graph-node-candidate:hover {
  border-color: var(--button-bg);
  transform: translateY(-1px) translateX(1px);
  box-shadow: 0 6px 14px rgba(28, 46, 61, 0.12);
}

.lab-graph-selected-placeholder {
  width: 100%;
  padding: 8px 10px;
  color: #5f7180;
  font-style: italic;
}

.lab-graph-end {
  border: 1px dashed #b5c0cc;
  border-radius: 12px;
  padding: 12px;
  background: #fafbfc;
  color: #5f7180;
}

.lab-graph-complete {
  border: 1px solid #bfe0cb;
  border-radius: 12px;
  padding: 11px 12px;
  background: #eff9f2;
  color: #2f6c43;
  font-weight: 700;
}

.footer {
  width: 100%;
  margin-top: clamp(12px, 1.5vw, 20px);
  padding: clamp(14px, 1.6vw, 22px);
  background: linear-gradient(125deg, #2a3238 0%, #20272d 70%);
  box-shadow: 0 -8px 24px rgba(24, 34, 43, 0.14);
  display: flex;
  justify-content: center;
}

.footer .mapping-footer {
  width: 100%;
  gap: 10px;
  justify-content: center !important;
  max-width: 980px;
  margin: 0 auto !important;
}

.footer .mapping-footer div {
  border-radius: 999px;
  border: 1px solid rgba(76, 175, 80, 0.35);
  background: #f5faf6;
  color: #245a2a;
  font-size: 0.92rem;
}

.popup {
  width: min(1040px, calc(100% - 30px));
  max-width: none;
  max-height: calc(100dvh - 76px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: clamp(18px, 2vw, 30px);
  box-shadow: var(--shadow-strong);
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid #c8d3dd;
  border-radius: 999px;
  background: #f3f7fb;
  color: #32424f;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.popup-close:hover {
  transform: scale(1.05);
  background: #e7eef5;
}

.popup > h2:first-of-type {
  padding-right: 48px;
}

#overlay {
  backdrop-filter: blur(4px);
  background: rgba(17, 22, 27, 0.44);
}

.popup h2,
.popup h3,
.popup h4 {
  color: #1e2a33;
}

.popup p,
.popup td,
.popup li,
.popup small {
  color: #4e5d69;
}

.popup th {
  background: #f0f5f9;
  color: #2b3944;
}

.setting-row {
  margin-bottom: 18px;
}

.slider {
  background-color: #d4dee7;
}

input:checked + .slider {
  background-color: var(--button-bg);
}

#loading-message,
#loading-message-first {
  margin: 0;
  border-radius: 12px;
  border: 1px solid #e7c679;
  background: #fff5da;
  color: #7f5a14;
}

#custom-alert {
  top: 20px;
  left: auto;
  right: 20px;
  transform: none;
  border: 1px solid #bdd9c2;
  border-radius: 12px;
  background: #eef8f0;
  color: #234d2b;
  box-shadow: var(--shadow-soft);
}

.correct {
  animation: pulse-green 0.46s ease;
}

.incorrect {
  animation: pulse-red 0.46s ease;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(76, 175, 80, 0);
  }
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(216, 72, 72, 0.36);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(216, 72, 72, 0);
  }
}

@media (max-width: 1080px) {
  #resoconto {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .header {
    min-height: 72px;
    padding: 10px 12px;
  }

  .header-left {
    left: 12px;
  }

  .header-actions {
    right: 12px;
  }

  .icon {
    width: 38px;
    height: 38px;
  }

  .title-container {
    max-width: calc(100% - 132px);
  }

  main {
    padding: 10px;
  }

  #game-container {
    min-height: 0;
    border-radius: 18px;
    padding: 14px;
  }

  #play-section.active {
    min-height: 0;
  }

  .mode-missions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-mission-card {
    padding: 14px;
  }

  #word-input,
  #number-input,
  #lab-unified-input {
    flex-basis: 100%;
  }

  .submit-btn,
  #start-button,
  .lab-convert-btn {
    width: 100%;
  }

  #input-group,
  .lab-input-group {
    flex-direction: column;
  }

  .footer .mapping-footer {
    justify-content: center;
  }

  .support-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lab-graph-hero-head,
  .lab-graph-hero-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .lab-graph-dict-toggle {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .lab-graph-node {
    width: auto;
    max-width: 100%;
  }

  .popup {
    width: calc(100% - 14px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
    padding: 14px;
  }
}
