:root {
  --ink: #172126;
  --muted: #607079;
  --paper: #f8f5ef;
  --panel: #ffffff;
  --line: #d9e1de;
  --teal: #0c6b62;
  --coral: #c85244;
  --gold: #d39b2f;
  --blue: #446b8f;
  --athens:
    linear-gradient(90deg, rgba(45, 35, 26, 0.2), rgba(245, 229, 196, 0.04), rgba(45, 35, 26, 0.24)),
    url("https://upload.wikimedia.org/wikipedia/commons/4/49/%22The_School_of_Athens%22_by_Raffaello_Sanzio_da_Urbino.jpg") center/cover;
  --shadow: 0 18px 50px rgba(28, 43, 48, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 5vw, 54px);
  overflow: hidden;
  background: var(--athens);
}

.login-screen::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 246, 220, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(36, 27, 22, 0.02), rgba(36, 27, 22, 0.34));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-title h2,
.view h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
}

.login-box {
  width: 100%;
  padding: 24px;
  border: 1px solid rgba(246, 232, 198, 0.78);
  border-radius: 8px;
  background: rgba(250, 244, 229, 0.86);
  box-shadow: 0 24px 70px rgba(35, 27, 22, 0.42);
  backdrop-filter: blur(8px);
}

.login-box h2 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin: 4px 0 0;
  font-size: 0.84rem;
}

.form,
.entry-form {
  display: grid;
  gap: 14px;
}

.form {
  margin-top: 0;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(101, 79, 55, 0.24);
  border-radius: 6px;
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  padding: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12, 107, 98, 0.13);
}

button,
.internal-link {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.error {
  min-height: 22px;
  margin: 0;
  color: var(--coral);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  background: var(--athens);
  background-attachment: fixed;
}

.tab,
.logout {
  background: transparent;
  color: var(--ink);
}

.logout {
  color: var(--coral);
}

.content {
  min-height: 100vh;
  padding: clamp(24px, 5vw, 58px);
  background: linear-gradient(180deg, rgba(248, 245, 239, 0.48), rgba(248, 245, 239, 0.82));
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-title,
.split-heading {
  max-width: 900px;
  margin-bottom: 28px;
}

.page-title h2,
.view h2 {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.02;
}

.page-title p,
.notice p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.7;
}

.split-heading {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
}

.home-top {
  position: relative;
  max-width: 1180px;
  margin: 0 auto 26px;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid rgba(246, 232, 198, 0.78);
  border-radius: 8px;
  background: rgba(250, 244, 229, 0.76);
  box-shadow: 0 24px 70px rgba(35, 27, 22, 0.28);
  backdrop-filter: blur(6px);
}

.top-logout {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 36px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--coral);
}

.language-vaults {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: clamp(14px, 3vw, 28px);
  padding-top: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.vault-card,
.home-link,
.entry-card,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(28, 43, 48, 0.08);
}

.vault-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 253, 247, 0.78);
}

.word-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.word-form input {
  min-height: 40px;
}

.word-form button {
  min-height: 40px;
  padding: 0;
  font-size: 1.2rem;
}

.chest {
  position: relative;
  width: min(100%, 180px);
  aspect-ratio: 1.35;
  border: 3px solid #5a3820;
  border-radius: 42px 42px 10px 10px;
  background:
    linear-gradient(90deg, transparent 0 46%, rgba(255, 226, 145, 0.9) 46% 54%, transparent 54%),
    linear-gradient(180deg, #9e6332 0 45%, #6f3f22 45% 100%);
  box-shadow:
    inset 0 10px 0 rgba(255, 226, 145, 0.22),
    inset 0 -12px 0 rgba(43, 25, 16, 0.2),
    0 18px 28px rgba(35, 27, 22, 0.22);
}

.chest::before,
.chest::after {
  position: absolute;
  content: "";
}

.chest::before {
  left: 0;
  right: 0;
  top: 42%;
  height: 10px;
  background: #d7a744;
  border-top: 2px solid #75512a;
  border-bottom: 2px solid #75512a;
}

.chest::after {
  left: 50%;
  top: 51%;
  width: 34px;
  height: 30px;
  border: 2px solid #5d421f;
  border-radius: 5px;
  background: linear-gradient(180deg, #f3ca62, #b7822f);
  transform: translateX(-50%);
}

.chest-count {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 1;
  min-width: 44px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.9);
  color: #503019;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

.vault-card strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.35rem;
}

.word-challenge {
  max-width: 760px;
  margin: 26px auto 0;
  padding: 18px;
  border: 1px solid rgba(101, 79, 55, 0.2);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.82);
  text-align: center;
}

.word-challenge p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.word-challenge strong {
  display: block;
  margin-bottom: 14px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.sentence-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.home-links {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.home-link {
  min-height: 160px;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 22px;
  background: rgba(255, 253, 247, 0.86);
  color: var(--ink);
  text-align: left;
}

.home-link:hover,
.home-link.active {
  background: rgba(231, 240, 237, 0.92);
}

.home-link span {
  color: var(--blue);
  font-weight: 800;
}

.home-link strong {
  display: block;
  margin: 10px 0 2px;
  font-size: 2.5rem;
}

.home-link small {
  color: var(--muted);
}

.notice h3 {
  margin: 0 0 8px;
}

.entry-form {
  max-width: 860px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.82);
}

.entry-form textarea,
.entry-form button {
  grid-column: 1 / -1;
}

.entry-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.entry-card {
  padding: 18px;
}

.entry-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.entry-card h3 {
  margin: 0;
  font-size: 1.06rem;
}

.pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef4f3;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
}

.stars {
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0;
}

.entry-card p {
  color: var(--muted);
  line-height: 1.55;
}

.delete {
  min-height: 34px;
  padding: 0 10px;
  background: #f7e7e3;
  color: var(--coral);
  font-size: 0.82rem;
}

@media (max-width: 820px) {
  .home-links,
  .entry-form {
    grid-template-columns: 1fr;
  }

  .split-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .login-screen,
  .content,
  .home-top {
    padding: 20px;
  }

  .login-box {
    padding: 22px;
  }

  .sentence-form {
    grid-template-columns: 1fr;
  }
}
