:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #18212f;
  --muted: #5f6b7c;
  --line: #dce3ec;
  --brand: #1b6d8b;
  --brand-dark: #15566d;
  --error: #b4233c;
  --focus: rgba(27, 109, 139, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #f2f5f9 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.container {
  max-width: 780px;
  margin: 2.2rem auto;
  padding: 0 1rem;
}

.card,
.result-shell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(18, 38, 63, 0.08);
}

.form-card {
  padding: 1.5rem 1.75rem 1.8rem;
}

input,
button {
  border-radius: 8px;
  font-size: 0.97rem;
}

.language-card {
  max-width: 640px;
  margin: 0 auto;
}

.language-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #eef2f6;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
}

.language-icon-svg {
  width: 28px;
  height: 28px;
  fill: #7b8796;
}

#language-title {
  text-align: center;
  margin: 0;
  font-size: 2rem;
}

#language-subtitle {
  margin: 0.55rem 0 1.2rem;
  text-align: center;
  color: var(--muted);
}

.language-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.language-option {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 1.15rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.language-option .flag {
  width: 44px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid rgba(24, 33, 47, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  margin-bottom: 0.25rem;
  display: inline-block;
}

.language-option .lang-name {
  font-size: 1.33rem;
  font-weight: 700;
}

.language-option .lang-helper {
  color: var(--muted);
}

.language-option:hover {
  border-color: #b8c5d8;
}

.language-option.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
}

.flag-es {
  background: linear-gradient(
    to bottom,
    #c60b1e 0%,
    #c60b1e 25%,
    #ffc400 25%,
    #ffc400 75%,
    #c60b1e 75%,
    #c60b1e 100%
  );
}

.flag-fr {
  background: linear-gradient(to right, #0055a4 0%, #0055a4 33.33%, #ffffff 33.33%, #ffffff 66.66%, #ef4135 66.66%, #ef4135 100%);
}

.flag-de {
  background: linear-gradient(
    to bottom,
    #000000 0%,
    #000000 33.33%,
    #dd0000 33.33%,
    #dd0000 66.66%,
    #ffce00 66.66%,
    #ffce00 100%
  );
}

.flag-en {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='t'%3E%3Cpath d='M0,0 v30 h60 v-30 z'/%3E%3C/clipPath%3E%3Cpath d='M0,0 v30 h60 v-30 z' fill='%23012169'/%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0,0 L60,30 M60,0 L0,30' clip-path='url(%23t)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30,0 v30 M0,15 h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30,0 v30 M0,15 h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

#language-continue-btn:disabled {
  background: #8f9399;
  cursor: not-allowed;
}

.logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.35rem;
}

.logo img {
  width: 150px;
  max-width: 90%;
  height: auto;
}

h1 {
  text-align: center;
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

#subtitle {
  text-align: center;
  color: var(--muted);
  margin: 0.55rem 0 0.4rem;
}

.note {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin-bottom: 1rem;
}

label {
  font-weight: 600;
  color: #243041;
}

input {
  border: 1px solid var(--line);
  padding: 0.72rem 0.78rem;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
.language-option:focus,
button[type='submit']:focus,
#language-continue-btn:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
}

button[type='submit'],
#language-continue-btn {
  width: 100%;
  border: 0;
  padding: 0.86rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button[type='submit']:hover {
  background: var(--brand-dark);
}

#language-continue-btn:not(:disabled):hover {
  background: var(--brand-dark);
}

button[type='submit']:active,
#language-continue-btn:active {
  transform: translateY(1px);
}

.message {
  border-radius: 8px;
  padding: 0.62rem 0.78rem;
  margin: 0 0 0.85rem;
}

.error {
  background: #fde7ec;
  color: var(--error);
}

.result-shell {
  overflow: hidden;
}

.result-header {
  background: linear-gradient(135deg, #1d728f 0%, #175d76 100%);
  color: #fff;
  text-align: center;
  padding: 1rem;
}

.result-header h2 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.01em;
}

.result-card {
  padding: 1.2rem 1.35rem 1.4rem;
}

.centered {
  text-align: center;
}

.muted {
  margin: 0.35rem 0 0.42rem;
  color: var(--muted);
  font-weight: 600;
}

#network-name {
  margin: 0 0 0.85rem;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.ticket-message {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
  line-height: 1.5;
}

#code-validity-note {
  margin-bottom: 1rem;
}

.instructions {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.95rem 1rem;
}

.instructions h5 {
  font-size: 1.02rem;
  margin: 0 0 0.6rem;
}

.instructions ol {
  margin: 0;
  padding-left: 1.12rem;
  color: #2a3748;
}

.instructions li {
  margin-bottom: 0.38rem;
  line-height: 1.4;
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  .container {
    margin: 1.1rem auto;
  }

  .form-card,
  .result-card {
    padding: 1rem;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #network-name {
    font-size: 1.65rem;
  }

  .language-grid {
    grid-template-columns: 1fr;
  }
}
