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

html, body {
  height: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

body {
  font-family: var(--font-main, 'Inter', system-ui, sans-serif);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: auto;
}

.toast.success { background: var(--accent3); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--accent); }

@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Offline banner */
#offline-banner {
  display: none;
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
}

#offline-banner.visible {
  display: block;
}

/* Shared */
.header-bar {
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-bar .user-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.header-bar .sub-info {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-mono);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.status-pill.online { background: var(--accent3); color: #fff; }
.status-pill.offline { background: var(--danger); color: #fff; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.1s;
  text-align: center;
}

.btn:active { transform: scale(0.97); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.btn-dark {
  background: var(--ink);
  color: #fff;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.btn-light {
  background: var(--paper);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-green {
  background: var(--accent3);
  color: #fff;
  border-color: var(--accent3);
}

.btn-full {
  width: 100%;
}

/* Language & theme toggles */
.top-controls {
  position: absolute;
  top: 8px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 100;
}

.toggle-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  font-weight: 700;
}

.toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}
