  * { box-sizing: border-box; }
  body {
    font-family: "Microsoft JhengHei", "Segoe UI", sans-serif;
    margin: 0; padding: 16px;
    background: linear-gradient(135deg, #232327, #161618);
    color: #ececec; min-height: 100vh;
  }
  h1 { margin: 0 0 12px; font-size: 24px; color: #ff9d42; text-shadow: 0 0 8px rgba(255,157,66,.4); }
  .toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
  button {
    background: #34343a; color: #ececec; border: 1px solid #4d4d55;
    padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 14px;
    transition: all .15s;
  }
  button:hover { background: #45454d; }
  button.primary { background: #ff7a1a; border-color: #ff9340; color: #1a1a1a; font-weight: bold; }
  button.primary:hover { background: #ff9340; }
  button.danger { background: #5a2a2a; border-color: #8a3a3a; }
  button.danger:hover { background: #8a3a3a; }
  .tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 2px solid #34343a; padding-bottom: 6px; }
  .tab {
    padding: 6px 12px; background: #1e1e22; border: 1px solid #34343a;
    border-radius: 6px 6px 0 0; cursor: pointer; font-size: 13px;
  }
  .tab.active { background: #ff7a1a; border-color: #ff9340; color: #1a1a1a; font-weight: bold; }
  .tab .close { margin-left: 6px; opacity: .6; }
  .tab .close:hover { opacity: 1; color: #ff7a1a; }
  .panel { background: #1c1c20; border: 1px solid #34343a; border-radius: 8px; padding: 14px; }
  .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
  .row label { font-size: 13px; color: #aaa; }
  input[type=text], input[type=number] {
    background: #26262b; color: #ececec; border: 1px solid #34343a;
    padding: 6px 10px; border-radius: 4px; font-size: 14px;
  }
  input[type=text]:focus, input[type=number]:focus { outline: none; border-color: #ff7a1a; }
  table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  th, td { padding: 6px 8px; border-bottom: 1px solid #34343a; text-align: left; font-size: 14px; }
  th { background: #26262b; color: #ff9d42; font-weight: normal; font-size: 13px; }
  td input { width: 100%; background: transparent; border: 1px solid transparent; padding: 4px 6px; }
  td input:hover { border-color: #34343a; }
  td input:focus { background: #26262b; border-color: #ff7a1a; outline: none; }
  td.drawn { background: rgba(255, 122, 26, 0.13); text-decoration: line-through; opacity: .6; }
  .small-btn { padding: 3px 8px; font-size: 12px; }
  .big-draw {
    display: block; width: 100%; padding: 16px; font-size: 22px; font-weight: bold;
    background: linear-gradient(45deg, #ff7a1a, #ffb066); color: #1a1a1a;
    border: none; border-radius: 8px; margin-top: 16px; cursor: pointer;
    text-shadow: 0 1px 0 rgba(255,255,255,.25);
    box-shadow: 0 4px 20px rgba(255, 122, 26, .35);
  }
  .big-draw:hover { transform: scale(1.02); }
  .big-draw:disabled { background: #444; color: #888; cursor: not-allowed; transform: none; box-shadow: none; }

  /* Slot machine modal */
  .modal-bg {
    position: fixed; inset: 0; background: rgba(0,0,0,.88);
    display: none; align-items: center; justify-content: center; z-index: 100;
  }
  .modal-bg.show { display: flex; }
  .modal {
    background: linear-gradient(135deg, #2a2a2f, #161618);
    border: 3px solid #ff9d42; border-radius: 16px;
    padding: 16px; max-width: 98vw; max-height: 96vh; overflow: auto;
    box-shadow: 0 0 40px rgba(255, 157, 66, .4);
  }
  .modal h2 { margin: 0 0 12px; color: #ff9d42; text-align: center; font-size: 32px; }
  .slot-grid { display: grid; gap: 18px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .modal { width: min(98vw, 1900px); }
  .slot-class { background: #1c1c20; border: 2px solid #4d4d55; border-radius: 10px; padding: 14px; min-width: 0; }
  .slot-class-name { color: #ff9d42; font-size: 24px; margin-bottom: 10px; text-align: center; font-weight: bold; }
  .slot-reels { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
  .reel {
    flex: 1 1 0; min-width: 0; max-width: 210px; height: 90px; background: #000;
    border: 2px solid #ff9d42; border-radius: 8px;
    overflow: hidden; position: relative;
    box-shadow: inset 0 0 10px rgba(255,157,66,.3);
  }
  .reel-inner {
    position: absolute; left: 0; right: 0; top: 0;
    display: flex; flex-direction: column;
  }
  .reel-item {
    height: 90px; box-sizing: border-box; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 0;
    color: #fff; font-weight: bold;
    border-bottom: 1px solid #333; padding: 0 6px; white-space: nowrap;
  }
  .reel-item .ri-seat { font-size: 18px; color: #bbb; line-height: 1.1; }
  .reel-item .ri-name { font-size: 44px; line-height: 1.05; }
  .reel.stopped { border-color: #ff7a1a; box-shadow: 0 0 20px rgba(255,122,26,.8); }
  .reel-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
  .reel-row { display: flex; align-items: center; gap: 8px; width: 100%; }
  .st-redraw.side {
    background: #34343a; color: #ececec; border: 1px solid #4d4d55;
    padding: 0; flex: 0 0 42px; height: 90px; border-radius: 6px;
    cursor: pointer; font-size: 22px;
  }
  .st-redraw.side:hover { background: #45454d; }
  .st-redraw.side:disabled { background: #26262b; color: #555; border-color: #34343a; cursor: not-allowed; }
  .status-btns {
    position: absolute; top: 4px; left: 0; right: 0; z-index: 5;
    display: flex; justify-content: space-between; padding: 0 5px;
    pointer-events: none; opacity: 0; transition: opacity .25s;
  }
  .reel.revealed .status-btns { opacity: 1; }
  .status-btns button { pointer-events: auto; padding: 2px 8px; font-size: 12px; line-height: 1.15; border-radius: 4px; }
  .status-btns .st-pass { background: #1f4d2b; border-color: #2e7a42; }
  .status-btns .st-pass.active { background: #2ecc71; color: #1a1a1a; border-color: #2ecc71; box-shadow: 0 0 8px rgba(46,204,113,.6); font-weight: bold; }
  .status-btns .st-fail { background: #4d1f1f; border-color: #7a2e2e; }
  .status-btns .st-fail.active { background: #e74c3c; color: #fff; border-color: #e74c3c; box-shadow: 0 0 8px rgba(231,76,60,.6); font-weight: bold; }
  .status-btns .st-redraw { background: #34343a; border-color: #4d4d55; }
  .status-btns .st-redraw:hover { background: #45454d; }
  .status-btns .st-redraw:disabled { background: #26262b; color: #555; border-color: #34343a; cursor: not-allowed; }
  .reel.stopped .reel-item.final { color: #ffb066; text-shadow: 0 0 8px #ff9d42; }
  .reel.res-pass { border-color: #2ecc71; box-shadow: 0 0 22px rgba(46,204,113,.85); }
  .reel.res-pass .reel-item.final .ri-name { color: #3ee07f; text-shadow: 0 0 10px #2ecc71; }
  .reel.res-fail { border-color: #e74c3c; box-shadow: 0 0 22px rgba(231,76,60,.85); }
  .reel.res-fail .reel-item.final .ri-name { color: #ff6b5c; text-shadow: 0 0 10px #e74c3c; }
  .modal-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; }
  .modal-actions button { font-size: 18px; padding: 10px 22px; }
  .hint { color: #888; font-size: 12px; margin-top: 4px; }
  .badge { display: inline-block; background: #ff7a1a; color: #1a1a1a; border-radius: 10px; padding: 1px 8px; font-size: 11px; margin-left: 6px; font-weight: bold; }
  textarea {
    width: 100%; min-height: 80px; background: #26262b; color: #ececec;
    border: 1px solid #34343a; border-radius: 4px; padding: 8px; font-family: inherit;
  }
  details { margin-top: 8px; }
  summary { cursor: pointer; color: #ff9d42; font-size: 13px; }

  /* NAS 版：頂列（存檔狀態、登出） */
  .topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
  .topbar h1 { margin: 0; }
  .who { margin-left: auto; color: #aaa; font-size: 14px; }
  .who a { color: #ff9d42; text-decoration: none; }
  .who a:hover { text-decoration: underline; }
  .save-status { font-size: 13px; color: #888; }
  .save-status.ok { color: #2ecc71; }
  .save-status.err { color: #ff6b5c; font-weight: bold; }

  /* 登入頁 */
  .login-page { display: flex; align-items: center; justify-content: center; }
  .login-card {
    background: #1c1c20; border: 1px solid #34343a; border-radius: 12px;
    padding: 36px 32px; width: min(92vw, 380px); text-align: center;
    box-shadow: 0 0 40px rgba(255, 157, 66, .15);
  }
  .login-card img { width: 64px; height: 64px; }
  .login-card h1 { margin: 12px 0 4px; }
  .login-card .sub { color: #888; margin: 0 0 24px; font-size: 14px; }
  .login-card input[type=password] { width: 100%; padding: 12px; font-size: 16px; background: #26262b; color: #ececec; border: 1px solid #34343a; border-radius: 6px; }
  .login-card input[type=password]:focus { outline: none; border-color: #ff7a1a; }
  .login-card .hint { margin-top: 14px; }
  .alert-error { background: #4d1f1f; border: 1px solid #7a2e2e; color: #ffb3aa; border-radius: 6px; padding: 10px; margin-bottom: 16px; font-size: 14px; text-align: left; }

  .hint a { color: #ff9d42; }
