:root {
  color-scheme: light;
  --bg: #f6f5ef;
  --panel: #ffffff;
  --text: #20211f;
  --muted: #687069;
  --line: #d9ddd4;
  --accent: #216869;
  --accent-strong: #164e50;
  --danger: #9d3b3b;
  --shadow: 0 18px 44px rgba(24, 35, 32, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
select,
textarea,
input {
  font: inherit;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 34%),
    #111413;
}

.login-card {
  width: min(360px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  padding: 22px;
}

.login-avatar {
  width: 104px;
  height: 104px;
  display: block;
  margin: 0 auto 16px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 28%;
  border: 3px solid #fff;
  box-shadow: 0 10px 24px rgba(32, 33, 31, 0.18);
}

.login-eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 25px;
  font-weight: 740;
  text-align: center;
}

.login-card label,
label span,
.editor-label,
.result-head span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.login-card input {
  margin-bottom: 12px;
}

.login-card button {
  width: 100%;
}

.login-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.app-shell {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 16px;
}

h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
  font-weight: 720;
}

.topbar p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.tool {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.actions,
.result-head,
.lang-grid {
  display: flex;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

.primary:hover {
  background: var(--accent-strong);
}

.icon-button,
.swap-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 20px;
}

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  align-items: end;
  margin-bottom: 14px;
}

select,
input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 13px;
  line-height: 1.55;
}

#resultText {
  min-height: 180px;
  background: #fbfcf9;
}

.actions {
  margin: 12px 0 16px;
}

.actions .primary {
  flex: 1;
}

.result-head {
  align-items: center;
  justify-content: space-between;
}

.result-head span {
  margin: 0;
}

#copyButton {
  min-height: 36px;
}

@media (max-width: 640px) {
  .login-card {
    padding: 20px;
  }

  .app-shell {
    padding-inline: 10px;
  }

  .tool {
    padding: 12px;
  }

  .lang-grid {
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
    gap: 6px;
    align-items: end;
  }

  .swap-button {
    width: 34px;
    min-width: 34px;
    min-height: 40px;
    margin: 0;
    font-size: 18px;
  }

  select {
    height: 40px;
    padding-inline: 8px;
    font-size: 14px;
  }

  label span,
  .editor-label,
  .result-head span {
    font-size: 12px;
  }

  textarea {
    min-height: 150px;
  }
}
