:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8e8e8;
  background: #101010;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 42px 18px;
}

.search-panel {
  padding: 0;
}

.top-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
}

.login-top-bar {
  justify-content: center;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1;
}

.auth-panel {
  display: flex;
  justify-content: flex-end;
  min-height: 44px;
}

.auth-panel p {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  color: #b8b8b8;
}

.auth-panel button {
  min-height: 40px;
  border: 1px solid #243b5a;
  border-radius: 12px;
  padding: 0 14px;
  color: #eeeeee;
  background: #222222;
  cursor: pointer;
}

.sign-in-panel {
  max-width: 360px;
  margin: 42px auto 0;
  padding: 24px;
  border: 1px solid #333333;
  border-radius: 18px;
  background: #1a1a1a;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-tabs button {
  min-height: 40px;
  border: 1px solid #333333;
  border-radius: 12px;
  color: #d0d0d0;
  background: #222222;
  cursor: pointer;
}

.auth-tabs button.active {
  border-color: #1d4ed8;
  color: #ffffff;
  background: #1e3a8a;
}

.sign-in-form {
  display: grid;
  gap: 6px;
}

.sign-in-form label {
  color: #d0d0d0;
  font-weight: 600;
}

.sign-in-form label:not(:first-child) {
  margin-top: 8px;
}

.sign-in-form input,
.sign-in-form button {
  min-height: 40px;
  border-radius: 12px;
}

.sign-in-form button {
  margin-top: 18px;
  border: 1px solid #1d4ed8;
  color: #ffffff;
  background: #1e3a8a;
  cursor: pointer;
}

.google-signin-button {
  width: 100%;
  height: 40px;
  margin-top: 22px;
  border-radius: 12px;
  overflow: hidden;
}

.google-signin-button iframe {
  border-radius: 12px;
}

.search-form {
  display: flex;
  gap: 10px;
}

input,
button,
textarea {
  font: inherit;
}

button,
input,
textarea,
.home-card,
.meaning-card,
.bookmark-tags-card,
.bookmark-note-card {
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

input,
.search-form button {
  min-height: 48px;
  border-radius: 14px;
}

input {
  width: 100%;
  border: 1px solid #1e40af;
  padding: 0 15px;
  color: #eeeeee;
  background: #161616;
}

input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #1e3a8a66;
  outline: 0;
}

.search-form button,
.load-more-button {
  border: 1px solid #1d4ed8;
  padding: 0 20px;
  color: #ffffff;
  background: #1e3a8a;
  cursor: pointer;
}

.auth-panel button:hover:not(:disabled),
.top-back-button:hover:not(:disabled),
.top-save-button:hover:not(:disabled) {
  border-color: #2563eb;
  background: #1b2638;
}

.search-form button:hover:not(:disabled),
.sign-in-form button:hover:not(:disabled),
.load-more-button:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #1d4ed8;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.status-row {
  position: relative;
  min-height: 40px;
  margin: 20px 0 0;
}

.status {
  min-height: 24px;
  margin: 0;
  padding-top: 8px;
  color: #b8b8b8;
  text-align: center;
}

.page-header-status {
  padding-top: 12px;
  color: #eeeeee;
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.status.error {
  color: #ff8a80;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.empty-message {
  margin: 0;
  padding: 18px;
  color: #b8b8b8;
  text-align: center;
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.load-more-button {
  min-height: 44px;
  border-radius: 14px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.home-card {
  min-height: 140px;
  border: 1px solid #243b5a;
  border-radius: 18px;
  color: #eeeeee;
  background-color: #1a1a1a;
  background-position: center;
  background-size: cover;
  cursor: pointer;
}

.words-card {
  background-image: linear-gradient(#00000099, #00000099), url("image/words.png");
}

.examples-card {
  background-image: linear-gradient(#00000099, #00000099), url("image/examples.png");
}

.notes-card {
  background-image: linear-gradient(#00000099, #00000099), url("image/notes.png");
}

.home-card:hover {
  border-color: #2563eb;
  background-color: #1a1f2a;
}

.home-card h2 {
  margin: 0;
  font-size: 1.35rem;
  text-shadow: 0 2px 8px #000000cc;
}

.meaning-card {
  width: 100%;
  padding: 18px;
  border: 1px solid #243b5a;
  border-radius: 18px;
  color: #eeeeee;
  text-align: left;
  background: #1a1a1a;
  cursor: pointer;
}

.meaning-card:hover {
  border-color: #2563eb;
  background: #1a1f2a;
}

.meaning-card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.meaning-card p {
  margin: 0;
  color: #c8c8c8;
}

.detail-panel {
  display: grid;
  gap: 16px;
}

.detail-card {
  overflow: hidden;
  border: 1px solid #333333;
  border-radius: 18px;
  background: #1a1a1a;
}

.detail-header {
  padding: 18px;
}

.detail-card h2 {
  margin: 0 0 8px;
}

.detail-card h3 {
  display: block;
  margin: 0;
  padding: 10px 18px;
  color: #ffffff;
  font-size: 0.95rem;
  background: #1e40af;
}

.detail-card p {
  margin: 0;
}

.detail-card:not(.detail-header) p {
  padding: 16px 18px 18px;
}

.detail-card:not(.detail-header) p + p {
  padding-top: 0;
}

.detail-loader {
  text-align: center;
}

.quote-card h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  background: #6d28d9;
}

.quote-source {
  color: #ffffff;
  line-height: 1;
  text-decoration: none;
}

.word-button {
  margin: 0 6px 6px 0;
  border: 1px solid #243b5a;
  border-radius: 999px;
  padding: 5px 10px;
  color: #eeeeee;
  background: #222222;
  cursor: pointer;
}

.word-button:hover {
  border-color: #2563eb;
  color: #ffffff;
  background: #1b2638;
}

.top-back-button,
.top-save-button {
  position: absolute;
  top: 0;
  min-height: 40px;
  border: 1px solid #243b5a;
  border-radius: 12px;
  padding: 0 14px;
  color: #eeeeee;
  background: #222222;
  cursor: pointer;
}

.top-back-button {
  left: 0;
}

.top-save-button {
  right: 0;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.save-star.saved {
  color: #facc15;
}

.bookmark-tags-card,
.bookmark-note-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid #333333;
  border-radius: 18px;
  padding: 10px 14px;
  color: #eeeeee;
  background: #1a1a1a;
}

.bookmark-tags-card strong,
.bookmark-note-card strong {
  flex: 0 0 auto;
  font-weight: 700;
}

.bookmark-tag-list {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.bookmark-tag {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
  border: 1px solid #1e40af;
  border-radius: 999px;
  padding: 3px 7px;
  color: #d0d0d0;
  font-size: 0.82rem;
  background: #222222;
}

.bookmark-tag button {
  border: 0;
  padding: 0;
  color: #b8b8b8;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.bookmark-tags-card input,
.bookmark-note-card textarea {
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #d0d0d0;
  text-align: left;
  background: transparent;
  outline: 0;
}

.bookmark-tags-card input {
  flex: 1 1 110px;
  width: 110px;
  min-width: 80px;
}

.bookmark-tags-card input:focus {
  border: 0;
  box-shadow: none;
  outline: 0;
}

.bookmark-tag-add-button {
  flex: 0 0 auto;
  margin-left: auto;
  border: 0;
  padding: 2px 4px;
  color: #b8b8b8;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.bookmark-tag-add-button:hover {
  color: #60a5fa;
}

.bookmark-note-card textarea {
  flex: 0 0 110px;
  width: 110px;
}

.bookmark-note-card textarea {
  resize: vertical;
  line-height: 1.4;
  overflow-wrap: anywhere;
  field-sizing: content;
}

.bookmark-tags-card:focus-within,
.bookmark-note-card:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px #1e3a8a66;
}

.bookmark-note-card {
  display: grid;
  align-items: start;
  gap: 4px;
}

.bookmark-note-card textarea {
  width: 100%;
}

.bookmark-tags-card input::placeholder,
.bookmark-note-card textarea::placeholder {
  color: #888888;
}

.pos {
  display: inline-flex;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #ffffff;
  background: #1e40af;
}

.user-tag {
  color: #000000;
  background: #ffffff;
}

.first-user-tag {
  margin-left: 4px;
}

.level-tag {
  display: inline-flex;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #ffffff;
  background: #1e3a8a;
}

.level-a1 {
  color: #ffffff;
  background: #15803d;
}

.level-a2 {
  color: #ffffff;
  background: #65a30d;
}

.level-b1 {
  color: #181818;
  background: #eab308;
}

.level-b2 {
  color: #ffffff;
  background: #ea580c;
}

.level-c1 {
  color: #ffffff;
  background: #dc2626;
}

.level-c2 {
  color: #ffffff;
  background: #7e22ce;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 540px) {
  .page {
    padding-top: 28px;
  }

  .home-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .home-card {
    min-height: 120px;
  }

  .search-form button {
    width: 54px;
    padding: 0;
    font-size: 0;
  }

  .search-form button::before {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("image/search.svg") center / contain no-repeat;
    content: "";
  }
}
