:root {
  --accent: #007AFF;
  --green: #34C759;
  --orange: #FF9500;
  --red: #FF3B30;
  --gray: #8E8E93;
  --bg: #F2F2F7;
  --card-bg: rgba(255, 255, 255, 0.82);
  --label: #1C1C1E;
  --secondary-label: #6B6B70;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, "SF Pro Display", "SF Pro Text", Inter, sans-serif;
  background: linear-gradient(180deg, #FAFAFC 0%, var(--bg) 100%);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: background 0.6s var(--ease-out);
  overflow: hidden;
}

body.wash-success { background: linear-gradient(180deg, #F3FCF5 0%, #E7F9EB 100%); }
body.wash-error   { background: linear-gradient(180deg, #FEF4F3 0%, #FCE9E8 100%); }

.screen {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.screen.active {
  display: flex;
  animation: rise-in 0.5s var(--spring) both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Shared card ---------- */
.card {
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0,0,0,0.04);
  padding: 28px 24px;
}

.app-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 0 8px;
}

.app-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--secondary-label);
  text-transform: uppercase;
  margin: 0 0 4px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

p.subtitle {
  font-size: 16px;
  color: var(--secondary-label);
  margin: 0;
  line-height: 1.4;
}

/* ---------- Inputs ---------- */
.field {
  width: 100%;
  text-align: left;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary-label);
  margin: 0 0 6px 4px;
}

.field input,
.field select {
  width: 100%;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(60, 60, 67, 0.13);
  background: rgba(118, 118, 128, 0.06);
  min-height: 44px;
  outline: none;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233c3c43' stroke-opacity='0.5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field input {
  background-image: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  background-color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--spring), opacity 0.15s var(--ease-out), background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); opacity: 0.85; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { background: #C7D9F5; cursor: default; }
.btn-secondary { background: rgba(0, 122, 255, 0.1); color: var(--accent); }

.error-text {
  color: var(--red);
  font-size: 14px;
  min-height: 18px;
  margin: 0;
}

/* ---------- Processing ring ---------- */
.tag-ring {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 8px auto;
}

.tag-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(0, 122, 255, 0.15);
}

.tag-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tag-icon {
  width: 56px;
  height: 56px;
  color: var(--accent);
  animation: pulse 1.6s var(--ease-out) infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.12); opacity: 0.7; }
}

/* ---------- Success checkmark ---------- */
.check-wrap {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  animation: pop-in 0.55s var(--spring) both;
}

@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.check-wrap svg { width: 56px; height: 56px; transform: translateX(2px); }

.check-wrap path {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw-check 0.4s var(--ease-out) 0.25s forwards;
}

@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

/* ---------- Error icon ---------- */
.error-wrap {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(255, 59, 48, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  margin: 0 auto;
  animation: shake-in 0.5s var(--spring) both;
}

@keyframes shake-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- Contact card ---------- */
.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  margin: 0 auto;
  animation: fade-scale 0.5s var(--spring) 0.15s both;
}

@keyframes fade-scale {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.teacher-name {
  font-size: 22px;
  font-weight: 700;
  animation: fade-scale 0.5s var(--spring) 0.22s both;
}

.action-line {
  font-size: 17px;
  color: var(--secondary-label);
  animation: fade-scale 0.5s var(--spring) 0.28s both;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  animation: fade-scale 0.5s var(--spring) 0.34s both;
}

.pill-late    { background: rgba(255, 149, 0, 0.14); color: #B25E00; }
.pill-present { background: rgba(52, 199, 89, 0.14); color: #1E7B36; }
.pill-early   { background: rgba(255, 149, 0, 0.14); color: #B25E00; }

.hint {
  font-size: 13px;
  color: var(--secondary-label);
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  color: var(--secondary-label);
}

/* ---------- Shop discount list ---------- */
.shop-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 8px;
  text-align: left;
}

.shop-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary-label);
  padding-left: 2px;
}

.shop-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: 14px;
  padding: 14px 16px;
}

.shop-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-name {
  font-size: 16px;
  font-weight: 700;
}

.shop-discount {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  background: rgba(52, 199, 89, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.shop-meta {
  font-size: 13px;
  color: var(--secondary-label);
  margin-top: 4px;
}
