
  :root{
    --bg-deep:#120c1f;
    --bg-deep-2:#1a1230;
    --panel:#1f1836;
    --panel-soft:#241c3f;
    --accent:#8b5cf6;
    --accent-soft:#a78bfa;
    --accent-bright:#c9b8ff;
    --text-primary:#f2eefb;
    --text-muted:#948aae;
    --text-faint:#655d7d;
  }

  *{ box-sizing:border-box; margin:0; padding:0; }

  html,body{
    min-height:100%;
    background:var(--bg-deep);
    color:var(--text-primary);
    font-family:'Inter', system-ui, sans-serif;
    -webkit-font-smoothing:antialiased;
    overflow-x:hidden;
  }
  
  @keyframes float1{
    0%,100%{ transform:translate(0,0); }
    50%{ transform:translate(30px,40px); }
  }
  @keyframes float2{
    0%,100%{ transform:translate(0,0); }
    50%{ transform:translate(-25px,-35px); }
  }

  .wrap{
    position:relative;
    z-index:1;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    align-items:center;
    padding:56px 20px 40px;
  }

  header{
    text-align:center;
    margin-bottom:30px;
  }
  .wordmark{
    font-family:'Outfit', sans-serif;
    font-weight:700;
    font-size:15px;
    letter-spacing:0.32em;
    color:var(--accent-bright);
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
  }
  .wordmark .dot{
    width:6px; height:6px; border-radius:50%;
    background:var(--accent-bright);
  }
  header h1{
    font-family:'Outfit', sans-serif;
    font-weight:600;
    font-size:26px;
    margin-top:10px;
    color:var(--text-primary);
  }
  header p{
    color:var(--text-muted);
    font-size:14px;
    margin-top:6px;
  }

  .card{
    width:100%;
    max-width:480px;
    background:linear-gradient(160deg, var(--panel-soft), var(--panel));
    border-radius:28px;
    padding:26px;
  }

  .tabs{
    display:flex;
    background:rgba(0,0,0,0.22);
    border-radius:16px;
    padding:5px;
    gap:4px;
    margin-bottom:22px;
  }
  .tab-btn{
    flex:1;
    border:none;
    background:transparent;
    color:var(--text-muted);
    font-family:'Inter', sans-serif;
    font-weight:600;
    font-size:13px;
    padding:11px 8px;
    border-radius:12px;
    cursor:pointer;
    transition:all .25s ease;
  }
  .tab-btn.active{
    background:linear-gradient(135deg, var(--accent), #6d28d9);
    color:#fff;
  }

  .panel{ display:none; }
  .panel.active{ display:block; animation:fadeIn .35s ease; }
  @keyframes fadeIn{ from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:translateY(0);} }

  .now-block{
    text-align:center;
    padding:14px 0 20px;
  }
  .now-clock{
    font-family:'Outfit', sans-serif;
    font-size:44px;
    font-weight:700;
    color:var(--text-primary);
    letter-spacing:0.02em;
  }
  .now-label{
    color:var(--text-muted);
    font-size:13px;
    margin-top:2px;
  }

  .primary-btn{
    width:100%;
    border:none;
    cursor:pointer;
    padding:16px;
    border-radius:18px;
    font-family:'Outfit', sans-serif;
    font-weight:600;
    font-size:15px;
    color:#fff;
    background:linear-gradient(135deg, var(--accent), #6d28d9);
    transition:transform .18s ease, .18s ease;
  }
  .primary-btn:hover{ transform:translateY(-2px);  }
  .primary-btn:active{ transform:translateY(0px) scale(0.99); }

  .field-label{
    font-size:13px;
    color:var(--text-muted);
    margin-bottom:10px;
    display:block;
  }

  .time-picker{
    position:relative;
    margin-bottom:16px;
  }
  .time-display{
    width:100%;
    background:rgba(0,0,0,0.24);
    border:none;
    outline:none;
    color:var(--text-primary);
    font-family:'Outfit', sans-serif;
    font-size:22px;
    font-weight:600;
    padding:14px 16px;
    border-radius:16px;
    text-align:left;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:space-between;
    transition:box-shadow .18s ease;
  }
  .time-display::after{
    content:"";
    width:9px; height:9px;
    border-right:2px solid var(--accent-soft);
    border-bottom:2px solid var(--accent-soft);
    transform:rotate(45deg);
    margin-top:-4px;
    transition:transform .2s ease;
  }
  .time-display.open::after{ transform:rotate(-135deg); margin-top:4px; }
  .time-display.open{ box-shadow:0 0 0 2px var(--accent-soft) inset; }

  .time-dropdown{
    position:absolute;
    top:calc(100% + 8px);
    left:0;
    right:0;
    background:linear-gradient(160deg, var(--panel-soft), var(--panel));
    border-radius:18px;
    box-shadow:0 20px 45px -15px rgba(10,5,25,0.6);
    padding:10px;
    display:none;
    gap:8px;
    z-index:30;
  }
  .time-dropdown.open{ display:flex; animation:fadeIn .2s ease; }

  .time-col{
    flex:1;
    max-height:180px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:2px;
    scrollbar-width:thin;
    scrollbar-color:var(--accent-soft) transparent;
  }
  .time-col.ampm-col{ flex:0 0 62px; }
  .time-col::-webkit-scrollbar{ width:5px; }
  .time-col::-webkit-scrollbar-thumb{ background:rgba(167,139,250,0.4); border-radius:10px; }

  .time-item{
    text-align:center;
    padding:8px 4px;
    border-radius:10px;
    font-family:'Outfit', sans-serif;
    font-size:14px;
    font-weight:600;
    color:var(--text-muted);
    cursor:pointer;
    transition:background .15s ease, color .15s ease;
  }
  .time-item:hover{ background:rgba(255,255,255,0.06); color:var(--text-primary); }
  .time-item.active{ background:var(--accent-soft); color:#1a1230; }

  .hint-text{
    font-size:12px;
    line-height:1.5;
    color:var(--text-faint);
    text-align:center;
    margin-top:10px;
  }
  
  /* Hotbar */
  .hotbar{
    display:flex;
    gap:8px;
    margin-bottom:16px;
  }
  .hotbar-btn{
    flex:1;
    border:none;
    background:rgba(0,0,0,0.24);
    color:var(--text-muted);
    font-family:'Inter', sans-serif;
    font-size:13px;
    font-weight:600;
    padding:10px 0;
    border-radius:12px;
    cursor:pointer;
    transition:all .2s ease;
  }

  .format-toggle{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-top:18px;
    padding-top:16px;
    border-top: none;
    position:relative;
  }
  .format-toggle::before{
    content:"";
    position:absolute;
    top:0; left:0; right:0;
    height:1px;
    background:rgba(255,255,255,0.06);
  }
  .format-toggle span{ font-size:13px; color:var(--text-muted); }
  .switch{
    display:flex;
    background:rgba(0,0,0,0.24);
    border-radius:12px;
    padding:3px;
  }
  .switch button{
    border:none;
    background:transparent;
    color:var(--text-muted);
    font-family:'Inter', sans-serif;
    font-size:12px;
    font-weight:600;
    padding:7px 12px;
    border-radius:9px;
    cursor:pointer;
    transition:all .2s ease;
  }
  .switch button.active{
    background:var(--accent-soft);
    color:#1a1230;
  }

  .results{
    margin-top:26px;
    display:none;
  }
  .results.show{ display:block; animation:fadeIn .4s ease; }

  .results-title{
    font-family:'Outfit', sans-serif;
    font-size:14px;
    font-weight:600;
    color:var(--text-muted);
    margin-bottom:14px;
    letter-spacing:0.02em;
  }

  .timeline{
    position:relative;
    padding-left:18px;
  }
  .timeline::before{
    content:"";
    position:absolute;
    left:5px;
    top:8px;
    bottom:8px;
    width:2px;
    background:linear-gradient(180deg, var(--accent-bright), transparent);
    opacity:0.35;
    border-radius:2px;
  }

  .result-card{
    position:relative;
    display:flex;
    flex-direction:column;
    background:rgba(255,255,255,0.03);
    border-radius:18px;
    padding:14px 16px;
    margin-bottom:10px;
    transition:background .2s ease;
  }
  .result-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
  }
  .result-desc{
    margin-top:8px;
    padding-top:8px;
    position:relative;
    font-size:12px;
    line-height:1.55;
    color:var(--text-muted);
  }
  .result-desc::before{
    content:"";
    position:absolute;
    top:0; left:0; right:0;
    height:1px;
    background:rgba(255,255,255,0.06);
  }
  .result-card:hover{ background:rgba(255,255,255,0.055); }
  .result-card::before{
    content:"";
    position:absolute;
    left:-18px;
    top:50%;
    transform:translateY(-50%);
    width:9px; height:9px;
    border-radius:50%;
    background:var(--accent-soft);
  }
  .result-card.best::before{
    background:var(--accent-bright);
  }

  .result-time{
    font-family:'Outfit', sans-serif;
    font-size:26px;
    font-weight:700;
    color:var(--text-primary);
    min-width:96px;
  }
  .result-meta{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    text-align:right;
  }
  .result-cycles{
    font-size:13px;
    color:var(--accent-bright);
    font-weight:600;
  }
  .result-duration{
    font-size:12px;
    color:var(--text-muted);
    margin-top:2px;
  }
  .result-time-wrap{
    display:flex;
    flex-direction:column;
    gap:3px;
    min-width:96px;
  }
  .result-time-wrap .result-time{ min-width:0; }

  .result-countdown{
    font-family:'Inter', sans-serif;
    font-size:13px;
    font-weight:600;
    color:var(--accent-bright);
  }

  .badge.soon-badge{
    background:#fbbf24;
    margin-left:4px;
  }

  .result-card.soon::before{
    background:#fbbf24;
    animation:pulseDot 1.4s ease-in-out infinite;
  }
  .result-card.soon .result-countdown{ color:#fbbf24; }
  @keyframes pulseDot{
    0%,100%{ box-shadow:0 0 0 0 rgba(251,191,36,0.55); }
    50%{ box-shadow:0 0 0 6px rgba(251,191,36,0); }
  }

  .result-card.passed{ opacity:0.5; }
  .result-card.passed .result-time{
    text-decoration:line-through;
    text-decoration-color:var(--text-faint);
    text-decoration-thickness:2px;
  }
  .result-card.passed .result-countdown{ color:var(--text-faint); }
  .result-card.passed::before{ background:var(--text-faint); }

  .badge{
    display:inline-block;
    font-size:10px;
    font-weight:700;
    letter-spacing:0.04em;
    color:#1a1230;
    background:var(--accent-bright);
    padding:2px 8px;
    border-radius:8px;
    margin-top:4px;
  }

  .result-tolerance{
    margin-top:6px;
    font-size:11.5px;
    font-weight:500;
    color:var(--accent-bright);
  }

  .tolerance-warning{
    display:flex;
    align-items:flex-start;
    gap:8px;
    background:rgba(139,92,246,0.1);
    border-radius:14px;
    padding:12px 14px;
    margin-bottom:16px;
    font-size:12px;
    line-height:1.55;
    color:var(--accent-bright);
  }
  .tolerance-warning::before{
    content:"!";
    flex:0 0 16px;
    height:16px;
    border-radius:50%;
    background:var(--accent-bright);
    color:#1a1230;
    font-family:'Outfit', sans-serif;
    font-weight:800;
    font-size:11px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-top:1px;
  }

  .note{
    margin-top:18px;
    font-size:12px;
    line-height:1.6;
    color:var(--text-faint);
    text-align:center;
    padding:0 6px;
  }

  footer{
    margin-top:28px;
    font-size:11px;
    color:var(--text-faint);
    text-align:center;
  }

  @media (max-width:520px){
    .wrap{ padding:36px 14px 30px; }
    .card{ padding:20px; border-radius:22px; }
    .now-clock{ font-size:36px; }
    .result-time{ font-size:22px; min-width:82px; }
}