:root {
  --font-mono: 'JetBrains Mono', monospace;
  --color-bg: #fafafa;
  --color-text: #111111;
  --color-muted: #888888;
  --color-border: #e0e0e0;
  --color-success: #22c55e;
  --color-found: #6366f1;
  --color-error: #ef4444;
  --max-width: 640px;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-mono), monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  padding: 40px 0 0;
}

.header-title {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.header-nav {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.header-nav a:hover {
  color: var(--color-text);
}

/* Home page */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

/* Word input */
.word-input-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--color-border);
  transition: border-color 0.2s;
}

.word-input-wrapper:focus-within {
  border-color: var(--color-text);
}

.word-input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  font-family: var(--font-mono), monospace;
  font-size: 1.5rem;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--color-text);
  outline: none;
}

.word-input::placeholder {
  color: var(--color-muted);
  font-size: 1rem;
}

.word-submit {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 1.25rem;
  background: transparent;
  color: var(--color-text);
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.word-submit:hover:not(:disabled) {
  opacity: 1;
}

.word-submit:disabled {
  opacity: 0.2;
  cursor: default;
}

.input-hint {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Result */
.result {
  margin-top: 32px;
  font-size: 0.875rem;
  animation: fadeIn 0.3s ease-in;
  max-width: 100%;
}

.result-new {
  color: var(--color-success);
}

.result-found {
  color: var(--color-found);
}

.result-error {
  color: var(--color-error);
}

.result-word {
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-all;
}

.dict-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-muted);
  text-decoration: none;
  vertical-align: middle;
  transition: all 0.15s;
}

.dict-link:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  text-decoration: none;
}

.result-meta {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Streak notification */
.streak-notification {
  margin-top: 20px;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  animation: streakIn 0.4s ease-out;
}

.streak-new {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.streak-found {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes streakIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Personal stats */
.personal-stats {
  margin-top: 48px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.personal-count {
  color: var(--color-text);
  font-weight: 600;
}

/* Info / Stats page */
.info {
  padding: 48px 0 80px;
}

.info-description {
  font-size: 0.875rem;
  color: var(--color-muted);
  max-width: 480px;
  margin-bottom: 48px;
  line-height: 1.8;
}

.info-description p {
  margin-bottom: 16px;
}

.info-description p:last-child {
  margin-bottom: 0;
}

/* Stats */
.stats-section {
  margin-bottom: 40px;
}

.stats-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: lowercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stats-value {
  font-size: 2rem;
  font-weight: 600;
}

.stats-total {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-muted);
}

/* Progress bar */
.progress-container {
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: 4px;
  transition: width 0.6s ease-out;
  min-width: 0;
}

.progress-text {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Top words list */
.top-list {
  list-style: none;
  font-size: 0.875rem;
}

.top-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.top-list li:last-child {
  border-bottom: none;
}

.top-word {
  font-weight: 600;
}

.top-count {
  color: var(--color-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Contributions */
.contributions {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border);
}

.streak-stat {
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.streak-stat-new {
  color: var(--color-success);
}

.streak-stat-found {
  color: var(--color-error);
}

.finds-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Sort controls */
.sort-controls {
  display: flex;
  gap: 4px;
}

.sort-btn {
  font-family: var(--font-mono), monospace;
  font-size: 0.65rem;
  color: var(--color-muted);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.sort-btn:hover {
  color: var(--color-text);
  border-color: var(--color-muted);
}

.sort-btn-active {
  color: var(--color-text);
  border-color: var(--color-text);
}

/* Recent finds */
.recent-finds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.recent-find {
  padding: 4px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--color-border);
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.find-count {
  font-size: 0.625rem;
  color: var(--color-muted);
}

/* Loading */
.loading {
  color: var(--color-muted);
  font-size: 0.875rem;
}
