:root{
  --text:#f5f5f5;
  --green:#2eea5a;
  --gold:#f0c777;
  --shadow: 0 10px 25px rgba(0,0,0,.45);
  --r: 28px;
  --w: min(520px, 94vw);
  --fn:#a9a9a9;
  --op:#f3a118;
  --card1:#3b3b3b;
  --card2:#2f2f2f;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(1200px 900px at 20% -10%, #171717 0%, #070707 40%, #000 75%);
  color:var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.screen{ width: var(--w); margin: 0 auto; padding: 16px 14px 14px; }

.top{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding-top:4px; }

.title{
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 6.2vw, 34px);
  line-height: 1.03;
  letter-spacing: .1px;
}

.stamp{ margin-top:8px; font-weight:600; letter-spacing:.6px; }
.date,.time{ color:var(--green); font-size: clamp(18px, 5.0vw, 28px); line-height:1.05; }

.actions{ display:flex; gap:10px; margin-top:6px; }
.iconbtn{
  width:52px; height:52px; border-radius:18px;
  background:#2b2b2b; border:0; box-shadow:var(--shadow);
  display:grid; place-items:center;
}
.iconbtn svg{ width:26px; height:26px; fill:#f1d2a0; opacity:.95; }
.iconbtn:active{ transform: translateY(1px); }

/* Currency rows */
.rates{ margin-top: 16px; display:flex; flex-direction:column; gap: 12px; }
.rateRow{ display:flex; gap: 12px; align-items:center; }

.pill{
  border-radius: var(--r);
  box-shadow: var(--shadow);
  background: linear-gradient(var(--card1), var(--card2));
  height: 74px;
  display:flex;
  align-items:center;
}

.leftPill{ width: 150px; justify-content:flex-start; padding: 0 16px; gap: 12px; }
.flag{
  width: 44px; height: 44px; border-radius: 50%;
  display:grid; place-items:center;
  font-size: 26px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}
.code{
  font-weight:600;
  font-size: 24px;
  letter-spacing:.4px;
  color:#d8d8d8;
}

.rightPill{
  flex: 1;
  justify-content:flex-end;
  padding: 0 20px;
}
/* smaller numbers */
.value{
  font-weight:600;
  font-size: clamp(30px, 6.5vw, 42px);
  letter-spacing: .3px;
  color:#efefef;
}

.rateRow.sel .leftPill,
.rateRow.sel .rightPill{ background: linear-gradient(#4c4027, #3e341f); }
.rateRow.sel .code,
.rateRow.sel .value{ color: var(--gold); }

/* Calculator */
.calc{ margin-top: 16px; }
.keys{ display:grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.k{
  border:0;
  border-radius: 999px;
  height: 60px;
  font-size: 24px;
  font-weight:600;
  color:#f1f1f1;
  background: #2e2e2e;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.k.fn{ background: var(--fn); color: #1a1a1a; }
.k.op{ background: var(--op); color: #171717; }
.k.zero{ grid-column: 1 / span 2; }
.k.eq{ font-size: 32px; }
.k:active{ transform: translateY(1px); }

/* Extra-tight small phones */
@media (max-width: 380px){
  .screen{ padding: 14px 12px 12px; }
  .iconbtn{ width:52px; height:52px; border-radius:18px; }
  .pill{ height: 68px; }
  .leftPill{ width: 142px; padding: 0 14px; }
  .code{ font-size: 28px; }
  .value{ font-size: clamp(36px, 7.6vw, 48px); }
  .keys{ gap: 10px; }
  .k{ height: 60px; font-size: 26px; }
  .k.eq{ font-size: 30px; }
}

/* Sheet */
.sheet{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:none; align-items:flex-end; justify-content:center;
  padding: 18px;
}
.sheet.show{ display:flex; }
.sheetCard{
  width: min(520px, 96vw);
  background: #111;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}
.sheetTitle{ font-weight:600; font-size:18px; margin-bottom:8px; }
.sheetBody{
  color:#ddd; font-size:14px; line-height:1.35;
  max-height:44vh; overflow:auto;
  background:#0b0b0b; border-radius:16px;
  padding:12px; white-space:pre-line;
}
.sheetClose{
  margin-top:12px; width:100%; height:44px;
  border:0; border-radius:16px;
  font-weight:600;
  background: var(--op);
  color:#111;
}

button{ -webkit-tap-highlight-color: transparent; user-select:none; }
